Hi:
I need to create a stored procedure in one database that depending on the passed parameter, pulls either a value from that database or a second database.
To boil it down, the code of the table population looks like this so far:
INSERT #TEMP
(mydescription)
select mydescription from table
select * from #temp
but what I'm looking for is more like this for the table population select :
select mydescription from
case when parameter=1 then dbONE.dbo.table.value
else dbTWO.dbo.table.value
which doesn't work. I have also tried to embed a begin and end inside the select and SQL doesn't like that either.
Any advice is greatly appreciated
I need to create a stored procedure in one database that depending on the passed parameter, pulls either a value from that database or a second database.
To boil it down, the code of the table population looks like this so far:
INSERT #TEMP
(mydescription)
select mydescription from table
select * from #temp
but what I'm looking for is more like this for the table population select :
select mydescription from
case when parameter=1 then dbONE.dbo.table.value
else dbTWO.dbo.table.value
which doesn't work. I have also tried to embed a begin and end inside the select and SQL doesn't like that either.
Any advice is greatly appreciated