Viewing 15 posts - 46 through 60 (of 812 total)
Sorry for [semi]colon 🙂
It's all right for error, because GO is a batch separator: @x is declared in the first batch and not in the second. It's the same as...
March 13, 2020 at 4:17 pm
A semicolumn is missing after the two exclamation mark.
Here's from BOL:
Supported SQLCMD Syntax
The Database Engine Query Editor supports the following SQLCMD script keywords:
[!!:]GO[count]
March 13, 2020 at 4:03 pm
5
Also with PRINT and RAISERROR
By that reasoning you should also include THROW, as well as modifying data in tables (particularly temp tables created by the caller).
Personally,...
February 28, 2020 at 1:10 pm
5
Also with PRINT and RAISERROR
By that reasoning you should also include THROW, as well as modifying data in tables (particularly temp tables created by the caller).
Personally, I would...
February 28, 2020 at 9:30 am
February 28, 2020 at 8:01 am
That's correct: "an empty result set preserves the existing value of the variable", NO result set, NO assignment. In the case of SET or SELECT with a subquery (as shown...
January 30, 2020 at 7:55 am
The interesting thing is that rounding to 1 decimal the result is 30.
DECLARE @tmp1 FLOAT = 0.289;
SELECT
CONVERT(INT, ROUND(@tmp1, 1) * 100.0)
January 16, 2020 at 9:21 am
I prefer "implicit transaction", they are more safe than "begin tran" in case you use "GO" in the script.
SET IMPLICIT_TRANSACTIONS ON
;with a
as
(
SELECT * FROM dbo.account WHERE account_code='4c'
)update...
November 24, 2019 at 5:34 pm
Inside dynamic sql I prefer to use the /**/ comment to avoid bug in concatenation.
Well Done.
November 8, 2019 at 9:41 am
GO
CREATE procedure spt
as
SELECT C.CustomerID
FROM
(
SELECT
sh.CustomerID,
OrderDate = MAX(sh.OrderDate)
FROM dbo.SalesHeader AS sh
GROUP BY sh.CustomerID
) AS C
INNER JOIN C AS c2
ON C.CustomerID = c2.CustomerID;
GO
This is a demonstration that the error is at execution time...
November 8, 2019 at 8:49 am
Here it stats https://docs.microsoft.com/it-it/sql/t-sql/statements/alter-database-transact-sql?view=sql-server-ver15, too.
October 28, 2019 at 8:14 am
I check my col1 it was a data type of int
It's impossibile because of division by 0.000 (with 3 decimal).
September 23, 2019 at 2:13 pm
I got it wrong, I thought you want the name of the month %B.
September 11, 2019 at 7:53 am
Viewing 15 posts - 46 through 60 (of 812 total)