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.

 All Forums
 SQL Server 2000 Forums
 SQL Server Development (2000)
 How the heck does this code work?

Author  Topic 

charlesmorris
Starting Member

11 Posts

Posted - 2001-07-25 : 19:54:11
This code works, but for the life of me I cant figgure out how. I'm simply using it to get output parameters from a dynamic sql string. I need to rewrite this so that the column names are declared because a Windows program I am using is getting an invalid cursor startement while trying to initialize it.

Its that it calls the insert statement prior to the exec statement.....

I'm lost.
TIA,
Charles

- - - - - - - - - - - -

declare @strOutput varchar(255)
declare @SQLString varchar(255)

create table #a (s varchar(255)
@SQLString = 'Select data from mycooldatabase'
insert #a
exec(@SQLString)
select @strOutput = s from #a
drop table #a


   

- Advertisement -