Viewing 7 posts - 1 through 7 (of 7 total)
When I run this code
DECLARE @Attachments VARCHAR(MAX);
SET @Attachments = 'E:\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Scripts\QMfiles\MedQuest\BH_' + CONVERT(VARCHAR(12), GETDATE(), 107 + '.xlsx)'
SELECT @Attachments
I get a syntax error at the select statement.
April 11, 2019 at 7:54 pm
It's reading the code as code not executing the date stamp.
(No column name)
E:\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Scripts\QMfiles\MedQuest\BH_CONVERT(VARCHAR(12), GETDATE(), 107.xlsx)
April 11, 2019 at 7:44 pm
LOL, That's just embarrassing... Thanks that worked perfectly much appreciated.
March 8, 2019 at 4:02 pm
I removed the Go but I still get an error.
[code language="sql"
Incorrect syntax near the keyword 'with'. If this statement is a common table expression, an...
March 8, 2019 at 2:12 pm
This worked Perfect thank you very much.
Where disch_yyyymm = FORMAT(DATEADD(MONTH, -2, GetDate()), 'yyyyMM');
February 15, 2019 at 6:00 pm
The data comes to me in this format 'yyyyMM'. What I need to do is query this field but with a dataadd -2 months. I'm using this in an SSIS...
February 15, 2019 at 5:18 pm
Interesting, when I try to do a -2 months to this I get.
2019-03-01 00:00:00.000
SELECT DATEADD(month, DATEDIFF(month, -2, GETDATE()), 0) AS StartOfMonth
February 15, 2019 at 5:00 pm
Viewing 7 posts - 1 through 7 (of 7 total)