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 2005 Forums
 Transact-SQL (2005)
 Referencing a variable

Author  Topic 

greg631
Starting Member

4 Posts

Posted - 2009-06-08 : 16:53:39
Hi -

Wondering if anyone knows how to reference a variable in Sybase 15.0.3? Here is what I want to do ...

xp_cmdshell 'C:\sybase\bin\bcp.exe database.dbo.EXPORT out d:\@filename.txt -c -t \n -r \n -U sa -P -S SYBASE15'

@filename is a variable set from one of the values in the export table. I want to export that row with bcp and save the results with the varaible's name.

ANY help would be appreciated.

If this is the wrong place to post, I appoligize in advance, but I can't find any info elsewhere.

THANKS!!

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2009-06-08 : 17:50:09
You should post your question on a Sybase forum as this site is for Microsoft SQL Server.

For that type of thing in SQL Server, you'd need to use dynamic SQL. I have no idea what would be needed for Sybase.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."
Go to Top of Page

greg631
Starting Member

4 Posts

Posted - 2009-06-08 : 22:34:43
Thanks!

Yeah, after I clicked 'send' I realized it might be an MS SQL forum. Sorry all.

Actually, I know that you can use the "&" instead of the "@" and it will work.... if only Sybase were as easy as MS SQL.

Thanks again.



quote:
Originally posted by tkizer

You should post your question on a Sybase forum as this site is for Microsoft SQL Server.

For that type of thing in SQL Server, you'd need to use dynamic SQL. I have no idea what would be needed for Sybase.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog

"Let's begin with the premise that everything you've done up until this point is wrong."

Go to Top of Page
   

- Advertisement -