![]() | |
![]() |
| | Thread Tools | Display Modes |
#1
| |||
| |||
|
#2
| |||
| |||
|
|
Is it possible to running cursor query in Execute SQl Task? My Cursor query is simple, just disable all constraint in all tables at a database : declare @tablename varchar(30), @str varchar(80) declare c1 cursor for select name from sysobjects where type = 'U' open c1 fetch next from c1 into @tablename while ( @@fetch_status <> -1 ) begin SET @str = 'alter table [dbo].[' + @tablename + '] nocheck constraint all ' Execute(@str) fetch next from c1 into @tablename end deallocate c1 go If it's not possible, i've plan to create stored procedure and then execute it from Execute SQL Task. 'Cause I want to execute that procedure at many database, is it right to put that sp at master database, so I can call it at all connection (database) ? Or could I use other DTS Task to replace the Exceute SQL Task? Any suggestion please... |
#3
| |||
| |||
|
#4
| |||
| |||
|
|
Which one? Cursor at Execute SQL Task or my backup plans (create sp)? Yes, i've tried Cursor at Execute SQL Task and get error : 'incorrect syntax near c1' but it's work when I execute that's query at Query Analyzer. And haven't try the backup plans...waiting for any other better suggestion. Thank you |
#5
| |||
| |||
|
|
Which one? Cursor at Execute SQL Task or my backup plans (create sp)? Yes, i've tried Cursor at Execute SQL Task and get error : 'incorrect syntax near c1' but it's work when I execute that's query at Query Analyzer. And haven't try the backup plans...waiting for any other better suggestion. Thank you |
#6
| |||
| |||
|
#7
| |||
| |||
|
#8
| |||
| |||
|
![]() |
| Thread Tools | |
| Display Modes | |
| |