June 6, 2022 at 5:19 pm
Hello!
Please, consider the following simple code
with cte AS (
SELECT
[cntSRVLDAPLOADAVERAGE]
FROM [watchdocstats].[dbo].[servercounters]);
WITH cteCORE AS ( SELECT * FROM cte );
SELECT * FROM cteCORE
Would someone please elaborate on why I get 'Incorrent syntax near ;' error?
June 6, 2022 at 5:33 pm
found the answer
https://stackoverflow.com/questions/18010850/sql-with-clause-within-a-with-clause
Happy coding!
June 6, 2022 at 5:50 pm
found the answer
https://stackoverflow.com/questions/18010850/sql-with-clause-within-a-with-clause
Happy coding!
Can you post the solution for the code you posted?
--Jeff Moden
June 6, 2022 at 9:31 pm
Getting carried away with the semicolons, and attempting to use two WITHs for one SELECT:
:WITH cte AS (
SELECT [cntSRVLDAPLOADAVERAGE]
FROM [watchdocstats].[dbo].[servercounters]
),
cteCORE AS ( SELECT * FROM cte
)
SELECT *
FROM cteCORE
SQL DBA,SQL Server MVP(07, 08, 09) "Money can't buy you happiness." Maybe so, but it can make your unhappiness a LOT more comfortable!
June 6, 2022 at 10:21 pm
Exactly! there's no way to nest 'with', but one can chain them.
Thank you!
June 7, 2022 at 8:38 am
Thank you for samples!
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply