Viewing 15 posts - 61 through 75 (of 825 total)
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
You also can create synonym without an existing object.
In your example you mismatched the synonym StagingSongs with SongStaging
CREATE SYNONYM SongStaging FOR #songs
GO
CREATE PROCEDURE dbo.LoadSongs
AS
INSERT Songs
(
songid,
title,
releasedate,
genre
)
SELECT songid,
title,
releasedate,
genre
FROM dbo.StagingSongs
WHERE...
September 6, 2019 at 6:56 am
The second dot is a "virtual AS".
Absolutely NO, but if you like to think so OK.
August 27, 2019 at 9:35 am
This clearly shows that if the expression before the dot is data type numeric,
then the expression after the dot is taken as a column name.
The dot is part of constant...
August 27, 2019 at 6:56 am
Viewing 15 posts - 61 through 75 (of 825 total)