Viewing 15 posts - 3,571 through 3,585 (of 8,753 total)
Avalin (5/18/2016)
May 18, 2016 at 9:04 am
Piling on
๐
-- this works
USE TEEST;
go
select object_id as GO
from sys.objects so
-- this doesn't
USE TEEST;
go
select object_id as
GO
from sys.objects so
The latter returns
Msg 102, Level 15, State 1, Line 10
Incorrect syntax near 'as'.
Msg...
May 17, 2016 at 10:17 am
dallas13 (5/17/2016)
Now we migrated to sql 2014 and we are getting...
May 17, 2016 at 10:05 am
SELECT
*
,(A)SUM(J.JourneyDistanceMiles)
,(B)SUM(J.JourneyTotalFuelUsed)*0.219969157
,(A)SUM(J.JourneyDistanceMiles) / NULLIF(((B)SUM(J.JourneyTotalFuelUsed)*0.219969157),0) as [MPG]
FROM tablename;
๐
May 17, 2016 at 9:46 am
If the divisor is zero then obviously the division is invalid, next thing for you is to check your data
๐
May 17, 2016 at 9:43 am
Then force NULL output if the divisor is 0
๐
SELECT
*
,(A)SUM(J.JourneyDistanceMiles)
,(B)SUM(J.JourneyTotalFuelUsed)*0.219969157
,(A)SUM(J.JourneyDistanceMiles) / NULLIF(((B)SUM(J.JourneyTotalFuelUsed)*0.219969157),0) as [(NEW COLUMN) A/B AS...
May 17, 2016 at 9:29 am
How about this?
๐
SELECT
*
,(A)SUM(J.JourneyDistanceMiles)
,(B)SUM(J.JourneyTotalFuelUsed)*0.219969157
,(A)SUM(J.JourneyDistanceMiles) / ((B)SUM(J.JourneyTotalFuelUsed)*0.219969157) as [(NEW COLUMN) A/B AS MPG]
FROM tablename
May 17, 2016 at 9:17 am
Lowell (5/16/2016)
I just got my MCSA after taking 70-463 Implementing a Data Warehouse in SQL Server 2012/2014.
I had set a mental...
May 16, 2016 at 9:31 am
GilaMonster (5/16/2016)
jasona.work (5/16/2016)
Last weekend, we had the windows of the house...
May 16, 2016 at 7:12 am
Solomon Rutzky (5/15/2016)
May 15, 2016 at 12:05 pm
Piling on on the CHAR(0), here are some of my favorites:
๐
SET NOCOUNT ON;
DECLARE @STR_WITH_ZERO_CHAR VARCHAR(20) = '123456789' + CHAR(0) + '1234567890';
-- CHARINDEX will not return the position of the CHAR(0)
SELECT...
May 15, 2016 at 10:54 am
Lynn Pettis (5/13/2016)
May 15, 2016 at 12:39 am
Jacob Wilkins (5/14/2016)
not being allowed to post the script
What do you mean by this?
๐
Date is obviously better than int or char but the OP was exactly on those conversions to...
May 14, 2016 at 2:01 pm
karthik M (5/13/2016)
I have a thought on converting integer value (whereas date is stored in INT format) to Date. The same column is declared as char(8), so the convert...
May 14, 2016 at 10:05 am
zahid.techk (5/14/2016)
I have facing problem to display information like Lag function, but Lag is not working on sql server 2012,
I want wo display data like tha...
Month_NameTotal_Test ...
May 14, 2016 at 3:40 am
Viewing 15 posts - 3,571 through 3,585 (of 8,753 total)