Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase

parameter in dataset Expand / Collapse
Author
Message
Posted Saturday, August 17, 2013 2:47 PM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Saturday, August 17, 2013 2:41 PM
Points: 4, Visits: 5
I am creating a parameter with the default value as test
in the dataset i need to use it in the query for the schema name. how do i do it

select * from (Parameters!param0.value).tablename;


i am getting an error missing right parenthesis. NOt sure how to do it? any suggestion
Post #1485521
Posted Saturday, August 17, 2013 7:15 PM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Thursday, October 9, 2014 1:35 PM
Points: 522, Visits: 238
You may use dynamic SQL statements. something like,

--@schema is parameter
Declare @val1 nvarchar(500)

SET @val1 ='Select * from ' + @schema+'.'+'TableName'
execute(@val1)
Post #1485539
Posted Monday, September 9, 2013 10:37 AM
SSC Eights!

SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!SSC Eights!

Group: General Forum Members
Last Login: Tuesday, April 1, 2014 6:12 PM
Points: 827, Visits: 342
Snigdha Vartak (8/17/2013)
You may use dynamic SQL statements. something like,

--@schema is parameter
Declare @val1 nvarchar(500)

SET @val1 ='Select * from ' + @schema+'.'+'TableName'
execute(@val1)


In similar case, Dynamic SQL worked for me.
Post #1492864
« Prev Topic | Next Topic »

Add to briefcase

Permissions Expand / Collapse