Viewing 15 posts - 526 through 540 (of 2,007 total)
sanjay831 (8/22/2012)
August 22, 2012 at 5:17 am
rajemessage (8/22/2012)
thing is i am keeping decimal (14,4) for from length and to length,
and it is not bridge it is road where paiting is going on.
will the query ...
August 22, 2012 at 4:02 am
venkidesaik (8/22/2012)
NOW IAM CLEARLY EXPLAING MY TASK,
SELECT DISTINCT ID FROM TABLE1
When i execute the above statement
The Output comes like this,
ID
----
100
200
300
400
500
so now i want to...
August 22, 2012 at 2:34 am
OK, let's setup some sample data first: -
SELECT bridgepid, fromlen, tolen
INTO #yourTable
FROM (VALUES(1,10,20),(2,18,21),(3,11,20),(4,40,50),(5,19,35)
)a(bridgepid, fromlen, tolen);
So, from that, we're expecting gaps of 1 -> 9...
August 22, 2012 at 1:48 am
GilaMonster (8/21/2012)
Cursors are tools. Use them where they work, don't use them where they don't. Statements like 'you should never use a <whatever>' are just shortsighted
If we count while loops...
August 21, 2012 at 3:00 am
The closest I can come is this: -
SELECT s.DealerCode, s.ForecastID, fc.ForecastId, fc.Name
FROM [dbo].[Forecast] fc
OUTER APPLY (SELECT code
FROM...
August 21, 2012 at 2:40 am
J Livingston SQL (8/20/2012)
;with cte as
(
SELECT ID, TranID, OriginCode AS scode, 1 as col
FROM #Test
union all
SELECT ID, tranID, DestinationCode AS scode, 2 as col
FROM ...
August 20, 2012 at 8:53 am
Requires more validation, I'd imagine. But something like this: -
SELECT
CAST(SUBSTRING(a.yourDate, 5, CHARINDEX('UTC',a.yourDate,1)-6) + SUBSTRING(a.yourDate,CHARINDEX('UTC',a.yourDate,1)+8,8000) AS DATETIME)
FROM (VALUES ('Thu Jun 14 15:07:06 UTC+0530 2012')) a(yourDate)
August 20, 2012 at 6:30 am
Really ugly recursive CTE solution (I'm hoping someone comes up with a better solution). The performance for this will scale terribly.
WITH CTE AS (
SELECT ID, TranID,
CASE WHEN a.N...
August 20, 2012 at 5:40 am
If we split your string based on the | deliminator, the result is as follows: -
ItemNumber Item
-------------------- ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
1 ...
August 20, 2012 at 4:23 am
Not sure what your expected output is, but the function you want is "ceiling".
SELECT Amt, CEILING(Amt/10)*10 AS groupByTens
FROM #Range;
Returns: -
Amt ...
August 18, 2012 at 6:30 am
Abu Dina (8/16/2012)
Respect my good man!
So we're rebuilding the string one character at a time and keeping only characters (LIKE '[a-z ''-]'). Maybe I'm just stupid but...
August 16, 2012 at 7:17 am
scott_lotus (8/16/2012)
August 16, 2012 at 2:48 am
Abu Dina (8/15/2012)
Cadavre, my sincerest apologies! :blush:
No problem. We're all here to learn and it's better to make a mistake on a forum than on production code, right? 😀
August 15, 2012 at 9:35 am
Adi Cohn-120898 (8/15/2012)
The UNIONs that some have posted are part of creating sample data so that they could test their solutions (really this is something you should have provided with...
August 15, 2012 at 9:30 am
Viewing 15 posts - 526 through 540 (of 2,007 total)