Viewing 15 posts - 4,996 through 5,010 (of 8,731 total)
And another solution using nested REPLACE.
WITH PartialNames AS (
SELECT * FROM (VALUES('first,,'),('first,,last'),(',middle,last')) d (PartialName)
)
SELECT REPLACE( REPLACE( RTRIM( LTRIM( REPLACE( PartialName, ',', ' '))), ' ', ','), ',,', ',')
FROM PartialNames
April 23, 2015 at 10:11 am
This might be more work for the engine but I was having some fun with the DelimitedSplit8k splitter.
WITH PartialNames AS (
SELECT * FROM (VALUES('first,,'),('first,,last'),(',middle,last')) d (PartialName)
)
SELECT
STUFF((SELECT ',' + item...
April 23, 2015 at 10:07 am
serg-52 (4/22/2015)
Luis Cazares (4/22/2015)
Your function is missing the ORDER BY at the end. It might seem to return the correct results but it might fail at any time.
Thank you, Luis....
April 22, 2015 at 5:12 pm
Your function is missing the ORDER BY at the end. It might seem to return the correct results but it might fail at any time.
April 22, 2015 at 1:48 pm
Just wanted to note that in SQL Server 2008 there's the DATE data type which won't include time. For hire dates it seems a better option.
Check the different Date and...
April 22, 2015 at 11:12 am
This can be done with a recursive CTE. You can find many examples on the internet.
It should be something like this:
WITH RCTE AS(
select T1.a1, T1.a2, T1.a3,
T2.b1,...
April 22, 2015 at 11:00 am
This is a possibility using the Quirky Update.
CREATE TABLE #TEMP (ID int PRIMARY KEY, DateCreated datetime, IsDoubleLag bit)
INSERT INTO #TEMP VALUES (1,'2015-01-01 08:11:40.490','0')
INSERT INTO #TEMP VALUES (2,'2015-01-04 02:29:47.777','1')
INSERT INTO #TEMP...
April 14, 2015 at 11:16 am
This is another option.
WITH Conditions AS(
SELECT ORGN, BDOB, TM_PERD
FROM (VALUES('A1', 'B1', 'C1'),
...
April 14, 2015 at 10:13 am
karodhill (4/14/2015)
i will certainly check that out but the requirement was to experiment with the cast function so i will keep trying thankyou
CAST is very simple :-). You'll have more...
April 14, 2015 at 9:56 am
Would you be comfortable using the Quirky Update? http://www.sqlservercentral.com/articles/T-SQL/68467/
April 14, 2015 at 9:36 am
Eirikur Eiriksson (4/14/2015)
Luis Cazares (4/13/2015)
cooljagadeesh (4/13/2015)
thanks bossDo you understand the solution that Eirikur provided? There's at least one question that I'd ask.
Don't be shy Luis, you can ask:-D
😎
I know, but...
April 14, 2015 at 9:35 am
The magic is in the REPLACE() which will implicitly convert the number into a string when it receives the data. Other string functions such as LEFT(), RIGHT(), LEN() and others...
April 14, 2015 at 9:32 am
sql-lover (4/14/2015)
I still would like to hear any advice but I think I can't rollback DDL statements in TSQL. In other words, and after...
April 14, 2015 at 9:22 am
Zingiber (4/14/2015)
What about joining the two tables?
SELECT DISTINCT SO.omlSalesOrderID
FROM m1_dc.dbo.SalesOrders AS SO
LEFT OUTER JOIN m1_dc.dbo.SalesOrderLines AS SOI
ON SO.ompSalesOrderID = SOI.ompSalesOrderID
WHERE SO.ompShippingMethodID='JBFM'
OR SOI.omlPartID='finalmile'
You'll need a FULL OUTER JOIN which...
April 14, 2015 at 9:12 am
Viewing 15 posts - 4,996 through 5,010 (of 8,731 total)