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 |
|
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-07-22 : 07:38:15
|
George writes "SQL server 2000 sp3CREATE PROCEDURE gspdMax @dmax int OUTPUTASBEGIN declare @wdbn varchar(80) declare @cmdline varchar(800) --get database name with UDF set @wdbn = ( dbo.gspwDBN() + '.dbo.sys_cfg') --build select stmt set @cmdline = ("(select [value] from " + RTRIM(@securitydbn) + " where cfg_varname='sys_dcd_levels')") exec (@cmdline ) --HOW DO I ACCOMPLISH THIS: --set @dmax = (EXEC(@cmdline))GOIn the above procedure, in database A, I obtain the name of another database.EXEC does not like the use of RTRIM, so I build @cmdlinethen run EXEC which in isqlw.exe returns one value from theselect.How do I return this value in the output variable @dmax?EXEC cannot set a declared variable because it thinksit's not declared.User Defined Functions don't allow EXEC with strings. " |
|
|
|
|
|