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)
 dynamic cursor

Author  Topic 

kode1
Starting Member

2 Posts

Posted - 2010-09-23 : 11:56:52
Hi all,

I am making stored procedure for backuping table in txt file. I am not just far. I gat to point where I need to fetch cursor into @variables, which havo to represent the table columns, but I didn't know how to make it dynamicaly. Every table has different number of columns.

How can I do this?

At the end I have to have
exec sp_backup_table 'table_name', 'path'

Any help is appreciated.

robvolk
Most Valuable Yak

15732 Posts

Posted - 2010-09-23 : 12:03:25
Have you considered the bcp utility? http://msdn.microsoft.com/en-us/library/ms162802.aspx

It can handle all the columns in the table automatically, and it's certainly faster than any cursor will ever be.
Go to Top of Page
   

- Advertisement -