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)
 Removing (1 row affected) from query output

Author  Topic 

blakmk
Starting Member

45 Posts

Posted - 2003-09-04 : 07:03:53
Im trying to retrieve the isql query output into a dos enironment variable. The query basically looks like this
SELECT 'set EnvVariable=' + column1 FROM table WHERE col1 = 'blah' > tempfile.bat

I'm redirecting the output to a file and then calling this file. The problem is that file also contains the number of rows effected by the query.
eg (1 row affected)

Does anyone know how to prevent this, or can suggest a better way to get the value back into an environment variable.

Thanks in advance
Mark



Frank Kalis
Constraint Violating Yak Guru

413 Posts

Posted - 2003-09-04 : 07:07:17
Are you looking for
SET NOCOUNT ON/OFF?

See BOL for details

Cheers,
Frank
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2003-09-04 : 12:41:09
Yes, SET NOCOUNT ON is what you want. You also should include this command at the top of your stored procedures as a good programming practice.

Also, use osql instead of isql. isql is going to be retired.

Tara
Go to Top of Page
   

- Advertisement -