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 to assign a compute result to a var ?

Author  Topic 

eurob
Posting Yak Master

100 Posts

Posted - 2005-08-24 : 14:45:19
I tried to use 'AS' but then I get a syntax error.


SELECT myfield from mytable
order by myfield
compute count(myfield) <--- How to assign this to a var




robert

X002548
Not Just a Number

15586 Posts

Posted - 2005-08-24 : 14:50:54
DECLARE @count int
SELECT @count=COUNT(myColumn) FROM myTable99

Brett

8-)

Hint: Want your questions answered fast? Follow the direction in this link
http://weblogs.sqlteam.com/brettk/archive/2005/05/25/5276.aspx
Go to Top of Page
   

- Advertisement -