Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
just.net
Starting Member
24 Posts |
Posted - 2010-05-25 : 08:42:55
|
Hi,I have SP:ALTER PROCEDURE [dbo].[GetDetails] @startDate datetime, @endDate datetime, @columnName nvarchar(20) -- this is the issueASBEGIN SET NOCOUNT ON; SELECT FirstName, LastName, Currency, TotalRoomsPrice FROM [ReportCurreDemo] -- this is the issue WHERE (@columnName BETWEEN @startDate AND @endDate) -- this is the issueHow can i do this? (select from column but with parameter). |
|
pk_bohra
Master Smack Fu Yak Hacker
1182 Posts |
Posted - 2010-05-25 : 09:01:34
|
One way is to use dynamic sql but remember that dynamic sql have some side effects.Edit: Refer the link for more information on dynamice sql. http://www.sommarskog.se/dynamic_sql.htmlRegards,BohraI am here to learn from Masters and help new bees in learning. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-05-25 : 09:03:29
|
No, you're never too old to Yak'n'Roll if you're too young to die. |
|
|
|
|
|