I want the users to choose a database @Environment. Then the applications plugs in the current servername + .dbo. + @environment + tablename.
How do I do that? Her is my case statement that I want it done in:
Case When detailobjectvalue like '%^MRN' then
(select top 1 cv.clientdisplayname from
(@MasterSQLServerName + '.dbo.' + @Environment + 'dbo.' + CV3Clientvisit) cv where cv.idcode = Replace(detailobjectvalue, '^MRN','') )
else ' '
end as clientdisplayname,
I have defined @Environment as a param and it passes in fine. My @MasterSQLServerName works fine retrieving the servername--It is stringing it together in a way that sql will read it where I have a problem.
Thanks in advance
TJ.
How do I do that? Her is my case statement that I want it done in:
Case When detailobjectvalue like '%^MRN' then
(select top 1 cv.clientdisplayname from
(@MasterSQLServerName + '.dbo.' + @Environment + 'dbo.' + CV3Clientvisit) cv where cv.idcode = Replace(detailobjectvalue, '^MRN','') )
else ' '
end as clientdisplayname,
I have defined @Environment as a param and it passes in fine. My @MasterSQLServerName works fine retrieving the servername--It is stringing it together in a way that sql will read it where I have a problem.
Thanks in advance
TJ.