Viewing 15 posts - 526 through 540 (of 7,187 total)
You need a parenthesis to close your first CTE definition, and you need to separate it from the second one with a comma, not a semi-colon.
John
April 12, 2019 at 2:51 pm
An ETL operation? What does that look like - simple query with linked servers, an SSIS package, a custom application, something else? Is it possible that some non-SQL component is...
April 11, 2019 at 3:55 pm
Take the MAX and MIN status, grouped by ID. You can then write your CASE expression similar to how you've done above.
John
April 11, 2019 at 3:53 pm
I don't think you can get column headers natively in T-SQL. You'd need to use sqlcmd to do the export and then PowerShell or your favourite scripting language to add...
April 11, 2019 at 7:43 am
Just put SET QUOTED IDENTIFIER ON at the top of the command in your job step.
John
April 8, 2019 at 7:42 am
If you work out what the last Monday was, and what the first Monday in August was, you can do a datediff in weeks to get the week number There's...
March 29, 2019 at 9:42 am
You said you ran it in sqlcmd - that's effectively the same as running it in an SSMS query. Run the cmd utility in Windows, and execute the command there.
March 15, 2019 at 10:58 am
bcp is a command-line utility. Run it from a Windows command prompt, not as a T-SQL query.
John
March 15, 2019 at 10:52 am
I don't really know, but here's a guess:SELECT
'North Central' AS Region
, nh.Grouping_Level AS Grouping_Level
, (COALESCE(nh.MTDValue,0) - COALESCE(nn.MTDValue,0) ) AS MTDValue
, (COALESCE(nh.MTDTarget,0) - COALESCE(nn.MTDTarget,0)...
March 15, 2019 at 9:42 am
Create a user for the login in the same database as the stored procedures. Grant EXECUTE permission on the stored procedures to the user. If the stored procedures are all...
March 11, 2019 at 10:40 am
Check whether the SQLPS Powershell module is located in the folder specified in the PSModulePath environment variable. If it isn't, either change the environment variable to the actual path of...
March 11, 2019 at 7:37 am
DECLARE @SYSTEM_USER sysname = 'DOMAIN\Joe.Bloggs';
WITH SystemUser (UserName) AS (
SELECT REPLACE(@SYSTEM_USER,'\','.')
)
SELECT
PARSENAME(UserName,2) AS FirstName
, PARSENAME(UserName,1) AS LastName
FROM SystemUser;
John
March 8, 2019 at 9:36 am
The error message tells you exactly what's wrong. You need to rewrite the subquery so it returns only one value.
John
February 26, 2019 at 1:45 am
Use MIN and MAX dateID, grouped by RecordID and Quantity. That'll work for your sample data, but it'll give strange results if you ever go back to the same Quantity...
February 21, 2019 at 9:24 am
I think those numbers refer to the schema versions, not the compile time and run time.
John
February 13, 2019 at 9:13 am
Viewing 15 posts - 526 through 540 (of 7,187 total)