Viewing 15 posts - 61 through 75 (of 819 total)
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
The explanation is that constant numbers are evaluated as one token! It doesn't matter if there is not a space at the end of the constant
These queries are equivalent:
August 26, 2019 at 7:28 am
I should try, but I think that if you specify "header=true or false" the first row contains column names (true= less names than columns, false=same number for names and columns.
August 7, 2019 at 1:34 pm
I found this in the syntax:
"header is set to TRUE if and only if the first row contains one fewer field than the number of columns."
So, because of the same...
August 7, 2019 at 7:53 am
The correct answer is: "The command seems to pause and hang, and the add file operation will run when the backup is complete."
From BOL: https://docs.microsoft.com/en-us/sql/t-sql/statements/backup-transact-sql?view=sql-server-2017
Interoperability
SQL Server uses an online...
July 18, 2019 at 8:03 am
Well done, "WAITFOR DELAY '00:00:05' " makes the difference.
June 17, 2019 at 9:18 am
Viewing 15 posts - 61 through 75 (of 819 total)