Viewing 15 posts - 436 through 450 (of 1,464 total)
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
A calendar table is definitely the better option.
But, just for fun, I have come up with 2 options that *SHOULD* work with SQL2000. Unfortunately I do not have SQL2000 to...
October 8, 2019 at 3:27 pm
the only days i would be exluding are weekend days (so no other holidays to be excluded).
so would a calendar still be the most appropriate way to do this?
I...
October 8, 2019 at 2:45 pm
Historically, I have found that Stored Procs out-perform functions such as these.
October 8, 2019 at 1:48 pm
Viewing 15 posts - 436 through 450 (of 1,464 total)