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
 Transact-SQL (2000)
 How can I execute an attribute?

Author  Topic 

zang
Starting Member

14 Posts

Posted - 2007-03-12 : 19:42:10
How can i execute an attribute who contain an sql sentence?
Example:
Table_reports
ReportNumber: integer
Query: Varchar (2000)

The query attribute must contain an sql sentence, for example “select * from client”.

How can I execute the query attribute in transact sql?.

Thanks in advance,
Ariel.

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2007-03-12 : 19:59:08
Your question is not very clear and smells of homework.

SELECT * FROM Table_reports

Tara Kizer
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2007-03-12 : 20:24:05
quote:
Originally posted by zang
...How can I execute the query attribute in transact sql?...


You could try the EXECUTE statement.


CODO ERGO SUM
Go to Top of Page

Lamprey
Master Smack Fu Yak Hacker

4614 Posts

Posted - 2007-03-13 : 12:11:33
Soemthing like:
DECLARE @Sql VARCAHR(2000)
SELECT @Sql = Query

FROM Table_reports
WHERE ReportNumer = 5

EXEC @Sql


-Ryan
Go to Top of Page
   

- Advertisement -