I have this...
declare
@.variable int
create table #tmp_datos
( variable int null )
insert into #tmp_datos
exec sp_prueba_era
select @.variable = variable
from
#tmp_datos
select @.variable
drop proc sp_prueba_era
go
create proc sp_prueba_era @.variable int output
as
declare
@.cmd varchar(250)
are there other way to do this??are you able to connect to your server using isql ?|||Yes, but I need to pass dinamically the name of the server, by this I'm using strings and exec...
But the original query it's this...
Select @.var = Select 1 from xx
I need to pass this to string...|||Originally posted by ramshree
are you able to connect to your server using isql ?
Not clear what you are trying to do.
but this works :
declare @.var char(100)
select @.var = 'select * from sysobjects'
exec (@.var)
-|||I'm trying to store a value in a variable into select statement, but my select statement it's a string that I'm going to execute with exec clause..., so I can't to do this...
declare
@.variable int,
@.cmd varchar(100)
select @.cmd = "select @.variable = 20"
exec (@.cmd)
because @.variable it's not a defined variable..., so how can I do for make a string like this...|||Maybe there is something, i haven't understood, but why is it so important, that the select is stored in the string?|||Hi,
Hope this is wat u want--
here i am assigning the count of the number of records to the variable @.varCountTable. but the whole string has to be executed in EXEC().
Personalize it to ur needs--
SET @.varSelectString = N'SELECT @.varCountTable = COUNT(*) FROM CPGSTAGEDB.DBO.' + @.varTableName
EXEC SP_EXECUTESQL @.varSelectString, N'@.varCountTable nvarchar(50) OUTPUT',@.varCountTable = @.varCountTable OUTPUT
Regards,
Ramya
Originally posted by ericka
I have this...
declare
@.variable int
create table #tmp_datos
( variable int null )
insert into #tmp_datos
exec sp_prueba_era
select @.variable = variable
from
#tmp_datos
select @.variable
drop proc sp_prueba_era
go
create proc sp_prueba_era @.variable int output
as
declare
@.cmd varchar(250)
are there other way to do this??
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment