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 2008 Forums
 Transact-SQL (2008)
 Openquery returning a Scalar Value

Author  Topic 

cidmi.dovic
Yak Posting Veteran

53 Posts

Posted - 2009-09-24 : 07:13:43
Hi,

I'm using an Openquery statement to retrieve information from Oracle.

As the query is dynamic i'm using

EXEC (@SQLQUERY)

The Query returns an Int but I don't figure out how to assigng this value into a variable.

Thanks.

The Padrón peppers itch and other don't

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2009-09-24 : 08:53:50
Read about sp_executesql in sql server help file

Another method is

declare @t table(data int)
insert into @t
EXEC (@SQLQUERY)

select data from @t

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -