Is it possible to assign a column to a variable in SQL Server?
That is, in a stored procedure, I want to use 1 stored procedure to select from a table based on the result of any column the user chooses.
i.e.
declare @someColumn as nvarchar (don't know if there's another datatype for this)
declare @value as nvarchar
set @someColumn = someIDkey
select *
from myDB
where @someColumn = @value
Suppose I had a database that kept track of login info. I want to have 1 stored procedure instead of multiple ones that would only get info based on the userID, username, password, login time, etc.
In short, I'd like to combine these (hypothetically - not my actual database I'm using) into 1 stored procedure. Is it possible?
Bookmarks