SET NOCOUNT ON GO If object_id('TestNoCount') is not null Drop procedure TestNoCount Go Create procedure TestNoCount (@number1 int, @number2 int) As Begin Declare @sum int,@Difference int,@product int set @sum=@number1 +@number2 select @sum Sum set @Difference=@number1-@number2 sele...
now I wrap the script into a procedure that I create called isSPRunning that receives as parameter @ProcedureName and check if @ProcedureName is running: USE MY_DATABASE GO GO CREATE procedure issprunning @ProcedureName VARCHAR(108) AS /* === Script : procedure issprunni...
BEGIN SET NOCOUNT ON; DECLARE @L_editDate INT = 0; DECLARE @L_MessageId BIGINT= 0; SELECT TOP ( 1 ) @L_MessageId = MessageId , @L_editDate = editDate FROM data2.[Message] WITH ( NOLOCK ) WHERE id = @id AND toId = @toId; IF ( ISNULL(@L_MessageId, 0) > 0 ) BEGIN...
DISCLAIMER : THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. */SETNOCOUNTON;DECLARE@iPrefixvarcha...
Alternatively, you can create pivot tables based on dynamic data sources; that is, if new columns are added, or if the existing data is modified or removed, the query will adjust the output automatically. DECLARE @colnameList VARCHAR(200), @SQLQuery NVARCHAR(MAX); SET @colnameList=NULL; ...
However, it is sometimes useful to execute update or delete commands on the database without involving the change tracker. EF7 enables this with the new ExecuteUpdate and ExecuteDelete methods. These methods are applied to a LINQ query and will update or delete entities in the database based ...
Hi friends I have a table which contain 5 columns .first three column insert with value and 4 and 5 were set to null. This is my stored procedure alter procedure sp_excelforgeneralholidays(@filname...
SET NOCOUNT ON SET XACT_ABORT ON There is no difference between this and the above. I prefer the version with one SET and a comma since it reduces the amount of noise in the code. As these statements should appear in all your stored procedures, they should take up as little space as ...
SET NOCOUNT ON -- Get size of SQL Server Page in bytes DECLARE @pg_size INT, @Instancename varchar(50) SELECT @pg_size = low from master..spt_values where number = 1 and type = 'E' -- Extract perfmon counters to a temporary table ...
goset nocount ongoinsert into t1 values (REPLICATE('X', 8000))go 1000gobegin traninsert into t1 values (REPLICATE('X', 8000))go 1000delete t1goset nocount offgo--use master--go--rollback2) From a second session, I execute the BACKUP DATABASE statemen...