![]() | |
![]() |
| | Thread Tools | Display Modes |
#31
| |||
| |||
|
|
Just another question on this topic... Assuming my SQL script is used with SQLCMD and I use it to "source" other scripts such as this: BEGIN TRY PRINT 'Installing Common' BEGIN TRANSACTION T1 :r Create\Common.SQL -- Does multiple INSERT PRINT 'Installing Add-on' IF @@TranCount > 0 BEGIN :r Create\AddOn.SQL -- Does multiple INSERT COMMIT TRANSACTION T1 END END TRY BEGIN CATCH ROLLBACK TRANSACTION T1 END CATCH GO Then my question is, would the approach you mentioned with @@transcount work here as well? or does it get "broken" by the fact that two child scripts (:r) are sourced? |
#32
| |||
| |||
|
|
Just another question on this topic... Assuming my SQL script is used with SQLCMD and I use it to "source" other scripts such as this: BEGIN TRY PRINT 'Installing Common' BEGIN TRANSACTION T1 :r Create\Common.SQL -- Does multiple INSERT PRINT 'Installing Add-on' IF @@TranCount > 0 BEGIN :r Create\AddOn.SQL -- Does multiple INSERT COMMIT TRANSACTION T1 END END TRY BEGIN CATCH ROLLBACK TRANSACTION T1 END CATCH GO Then my question is, would the approach you mentioned with @@transcount work here as well? or does it get "broken" by the fact that two child scripts (:r) are sourced? |
#33
| |||
| |||
|
|
Just another question on this topic... Assuming my SQL script is used with SQLCMD and I use it to "source" other scripts such as this: BEGIN TRY PRINT 'Installing Common' BEGIN TRANSACTION T1 :r Create\Common.SQL -- Does multiple INSERT PRINT 'Installing Add-on' IF @@TranCount > 0 BEGIN :r Create\AddOn.SQL -- Does multiple INSERT COMMIT TRANSACTION T1 END END TRY BEGIN CATCH ROLLBACK TRANSACTION T1 END CATCH GO Then my question is, would the approach you mentioned with @@transcount work here as well? or does it get "broken" by the fact that two child scripts (:r) are sourced? |
#34
| |||
| |||
|
|
Just another question on this topic... Assuming my SQL script is used with SQLCMD and I use it to "source" other scripts such as this: BEGIN TRY PRINT 'Installing Common' BEGIN TRANSACTION T1 :r Create\Common.SQL -- Does multiple INSERT PRINT 'Installing Add-on' IF @@TranCount > 0 BEGIN :r Create\AddOn.SQL -- Does multiple INSERT COMMIT TRANSACTION T1 END END TRY BEGIN CATCH ROLLBACK TRANSACTION T1 END CATCH GO Then my question is, would the approach you mentioned with @@transcount work here as well? or does it get "broken" by the fact that two child scripts (:r) are sourced? |
#35
| |||
| |||
|
|
Just another question on this topic... Assuming my SQL script is used with SQLCMD and I use it to "source" other scripts such as this: BEGIN TRY PRINT 'Installing Common' BEGIN TRANSACTION T1 :r Create\Common.SQL -- Does multiple INSERT PRINT 'Installing Add-on' IF @@TranCount > 0 BEGIN :r Create\AddOn.SQL -- Does multiple INSERT COMMIT TRANSACTION T1 END END TRY BEGIN CATCH ROLLBACK TRANSACTION T1 END CATCH GO Then my question is, would the approach you mentioned with @@transcount work here as well? or does it get "broken" by the fact that two child scripts (:r) are sourced? |
#36
| |||
| |||
|
|
Just another question on this topic... Assuming my SQL script is used with SQLCMD and I use it to "source" other scripts such as this: BEGIN TRY PRINT 'Installing Common' BEGIN TRANSACTION T1 :r Create\Common.SQL -- Does multiple INSERT PRINT 'Installing Add-on' IF @@TranCount > 0 BEGIN :r Create\AddOn.SQL -- Does multiple INSERT COMMIT TRANSACTION T1 END END TRY BEGIN CATCH ROLLBACK TRANSACTION T1 END CATCH GO Then my question is, would the approach you mentioned with @@transcount work here as well? or does it get "broken" by the fact that two child scripts (:r) are sourced? |
#37
| |||
| |||
|
|
Just another question on this topic... Assuming my SQL script is used with SQLCMD and I use it to "source" other scripts such as this: BEGIN TRY PRINT 'Installing Common' BEGIN TRANSACTION T1 :r Create\Common.SQL -- Does multiple INSERT PRINT 'Installing Add-on' IF @@TranCount > 0 BEGIN :r Create\AddOn.SQL -- Does multiple INSERT COMMIT TRANSACTION T1 END END TRY BEGIN CATCH ROLLBACK TRANSACTION T1 END CATCH GO Then my question is, would the approach you mentioned with @@transcount work here as well? or does it get "broken" by the fact that two child scripts (:r) are sourced? |
![]() |
| Thread Tools | |
| Display Modes | |
| |