Viewing 15 posts - 436 through 450 (of 1,468 total)
This looks like you are trying to do an UPDATE. If so, then
UPDATE YourTable
SET columnB = CASE
...
October 17, 2019 at 4:33 pm
Remove this part
PARTITION BY WhatWeight
October 17, 2019 at 3:02 pm
I have not checked this against your spreadseet
WITH cteBase AS (
SELECT whb.ID, whb.grower, whb.block, whb.section, whb.year, whb.weight, whb.payclass
...
October 17, 2019 at 11:04 am
hi
here i am again with a noob question again:
i'm trying to do this:
case
when columnA <> 0
then columnB = 1
else columnB
end
but it return error.
i used...
October 17, 2019 at 10:11 am
Use coalesce to replace the null value
set @log = @Log + ' ,Date: ' + coalesce(@Date, 'NULL')
October 16, 2019 at 5:36 pm
You can create an iTVF that will generate numbers on the fly
CREATE FUNCTION [dbo].[fn_GetNums](
@low AS BIGINT
, @high AS BIGINT
)
RETURNS TABLE...
October 16, 2019 at 4:45 pm
You could use a dynamic cross-tab query. Take a look at the following 2 articles by Jeff Moden
October 16, 2019 at 11:48 am
You want to use SUM and not COUNT
Select distinct Model_id,
SUM(CASE WHEN Doors = 4 then 1 ELSE 0 END) [4DoorCount],
SUM(CASE WHEN Doors = 2 then 1 ELSE...
October 16, 2019 at 11:36 am
You either have to add a filter into your stored procedure, or store the results of your stored procedure in a table, and then re-query that table.
October 16, 2019 at 11:28 am
EXEC dbo.LogTable @Inserted,@Updated is outside of the catch block, so it will run after the rollback.
Also, @Inserted and @Updated are variables, which do not revert their value on rollback. You...
October 16, 2019 at 4:07 am
Add the following to your WHERE clause
AND name LIKE 'DBA%'
October 15, 2019 at 9:19 pm
If newtable exists ...
;with cte as
(
select col1, col2, ...
from ...
)
insert into newtable (col1, col2, ...)
select col1, col2, ...
from cte
If newtable does not exist
October 14, 2019 at 4:28 pm
You've discovered the hard way why it's not a good idea to store dates in a char column. That's not a criticism of you - I'm sure it's not...
October 14, 2019 at 4:15 pm
It seems that if you simply add a '0' to the end of your string, it converts correctly
DECLARE @charDateTime char(22) = '2012-06-03 04:11:49:16';
SELECT CONVERT(datetime, @charDateTime+'0', 121)
October 14, 2019 at 4:10 pm
If you change %3.00 to %3 then you will also remove the floating point issue.
October 12, 2019 at 5:01 am
Viewing 15 posts - 436 through 450 (of 1,468 total)