Question:
I am having a select statement in Stored Procedure in Sql Server 2005, can anyone plz explain that select stmt
syed j
2008-01-14 03:42:21 UTC
I am using Sql server 2005, I have a stored procedure, in that a select statement
SELECT
ColumnName' + @InputVariableName + '
FROM
TableName
I am not getting what it means
ColumnName' + @InputVariableName + '

Can anyone help me who know's this.
Three answers:
Amal
2008-01-14 03:47:15 UTC
the procedure accepts a string argument



and the select statement selects the columns having the name of the format



ColumnNameXXXXX



Where XXXXX is the argument @InputVaribleName





Enjoy!!!
?
2016-05-25 05:24:31 UTC
CREATE PROCEDURE dbo.myTestDelete(@id int) AS SET NOCOUNT ON DELETE FROM [Tablename] WHERE ID = @id GO Select is very similar. Inserts and updates are much more complicated as it depends on the table in question. You basically need to send in a value for every column in the table. But the concept is the same ... send in all the values you need to build the query and where you would do something like "WHERE ID = 5" in a normal query, you will replace that "5" with a variable (E.G. @id).
Gk
2008-01-14 04:46:05 UTC
set @InputVariableName= '_0'

SELECT Name+@InputVariableName FROM MyInfo



The result values for column Name will be appended with '_0'.

So if Names were asd,qew,..

The result will contain, asd_0,qew_0,...

The @InputVariableName can come from as an input parameter in you case.



Like that if it were of int datatypes, you will get the sum of column value and the @InputVariableName



1,2,3 with @InputVariableName =10 will result in

11,12,13,..


This content was originally posted on Y! Answers, a Q&A website that shut down in 2021.
Loading...