Viewing 15 posts - 31 through 45 (of 77 total)
GSquared (12/17/2009)
I agree, but I add an additional check.
if object_id(N'[ProcName]','P') is null and object_id(N'[ProcName]') is not null
raiserror('Object name in use', 21, 1) with log;
That aborts the...
December 17, 2009 at 2:58 pm
Additionally it would probably be a good idea to do a check before trying the rollback. It is a good practice to ensure the transaction can be rolled back.
Possible...
December 16, 2009 at 1:29 pm
Using a DROP/CREATE with an IF EXISTS clause instead of an ALTER statement for deploying SQL Server objects like stored procedures is one example of a standard that can be...
December 16, 2009 at 12:03 pm
Your declared sizes are possibly going to cause truncation:
@ProcedureName VARCHAR(50) = NULL,
@SourceServer VARCHAR(50) = NULL,
@SourceDatabase VARCHAR(50) = NULL,
@TargetServer VARCHAR(50) = NULL,
@TargetDatabase VARCHAR(50) = NULL
maybe declare them as this:
@ProcedureName sysname =...
December 15, 2009 at 10:04 am
If you want to script out the stored procedures and other objects to 1 file or multiple files you can do so using the "Generate Scripts" menu command in SSMS...
December 1, 2009 at 9:50 am
I am not saying whether you should or shouldn't use dynamic SQL but since you are trying to learn it, here is a way you might write something to play...
November 25, 2009 at 1:05 pm
Also splitting it up across multiple stored procedures will be more conducive to concurrent development within a team of developers.
November 25, 2009 at 12:16 pm
Steve Jones - Editor (11/13/2009)
Jeff Moden (11/12/2009)
November 13, 2009 at 9:32 am
Paul White (11/7/2009)
Adam Gojdas (11/7/2009)
WHILE (XACT_STATE() <> 0) BEGIN
ROLLBACK TRANSACTION;
END;
Hey Adam,
Not trying to be 'smart' here...but ROLLBACK always rolls back completely, through any number of 'nested' transactions.
You...
November 8, 2009 at 6:17 am
Paul White (11/6/2009)
SQL Guy-482125 (11/4/2009)
Thanks, that's good solution, you moved insert ouside of transaction. This is what I needed.
You might like to change the ROLLBACK TRANSACTION to:
IF XACT_STATE() != 0...
November 7, 2009 at 9:52 am
Paul White (11/6/2009)
Adam Gojdas (11/5/2009)
November 7, 2009 at 9:43 am
Please be aware the ERROR_MESSAGE() function returns a nvarchar(4000). So you will run the risk of truncating some of the messages using the variable declared as varchar(100).
November 5, 2009 at 11:38 am
venu_ksheerasagaram (11/1/2009)
Here i am having a doubt regarding the Dynamic Query. My requirement is How to store the Dynamic Query resultset into a TempTable? Could it possibel?
Because...
November 3, 2009 at 9:05 am
Bhuvnesh (11/11/2008)
hi ken,thanks it works:)
but can u explain the whole scenario.
Here this may help a little:
DECLARE @word sysname
EXEC sp_executesql
N'SELECT TOP 1 @DynamicWord = [name] FROM sysobjects' --dynamic sql...
November 3, 2009 at 8:59 am
Viewing 15 posts - 31 through 45 (of 77 total)