Viewing 15 posts - 8,746 through 8,760 (of 10,143 total)
karthikeyan (3/3/2009)
His method is working fine. I have tested it.Actually my requiremrnt is little bit different what he has given.
Can you demonstrate please, Karthik? I'd be very keen to...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 3, 2009 at 8:19 am
If new rows were going into table1 until it was replaced by table2, then this might be more appropriate:
SELECT emp_id, name, CAST(NULL AS CHAR(20)) AS emp_address, DOB
FROM table1
UNION ALL
SELECT...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 3, 2009 at 6:58 am
karthikeyan (3/3/2009)
Thanks for all your inputs!:)
I found the TSQL 101 solution.
Declare @InputDate Datetime
select @InputDate = '02/mar/2009'
select case when upper(datename(dw,@InputDate)) = 'MONDAY' then dateadd(dd,-7,@InputDate)
...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 3, 2009 at 5:07 am
When writing an UPDATE ... FROM ..., it pays to write it as a SELECT first, to see what rows are going to be affected and what the new values...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 3, 2009 at 3:59 am
Jeff Moden (3/2/2009)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 2, 2009 at 9:34 am
Here's the same code with the outer loop removed and the update statements
replaced by PRINT statements, to try to identify what this thing does.
I made the assumption that...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 2, 2009 at 9:32 am
Here's a quick sample using Jeffs' suggestion of PARSENAME:
DROP TABLE #Sample
CREATE TABLE #Sample (id INT, PersonName VARCHAR(100))
INSERT INTO #Sample (id, PersonName)
SELECT 1,'Doe, John H.' UNION ALL
SELECT 2,'Pardeshi, Mangal' UNION ALL
SELECT...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 2, 2009 at 4:37 am
Jeff Moden (2/27/2009)
Also, just a friendly tip... you don't...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
March 2, 2009 at 2:27 am
Check triggers on company_ext_attributes
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 27, 2009 at 8:00 am
Jeff Moden (2/27/2009)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 27, 2009 at 6:48 am
saravanantvr1984 (2/27/2009)
My hearty thanks to Chris Morris
That's nice - you're welcome!
I have to agree with Jeff however, this type of processing is almost always better done by the application/presentation...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 27, 2009 at 6:42 am
Hi Crazyman
If you look at the result from the sample query
SELECT a.[Date], a.Userid, a.[Name] , '#', b.UseridRef, b.Userid
FROM #Temp a (nolock)
LEFT JOIN #TempCross b(nolock)
ON 'S000'+ CAST(b.UseridRef AS...
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 27, 2009 at 6:36 am
Have some coffee - the expressions are the wrong way round in the function 🙂
declare @searchterm nvarchar(200)
SET @searchterm = 'blood and sweat'
SELECT charindex(@SearchTerm,'and'), charindex('and', @SearchTerm)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 27, 2009 at 4:55 am
GilaMonster (2/26/2009)
Jeff Moden (2/26/2009)
All database names, table names, procedure names, column names, column aliases, variable names (basically, my stuff) etc, in MixedCase with no underscores....
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 27, 2009 at 2:20 am
Jack Corbett (2/26/2009)
For fast, accurate and documented assistance in answering your questions, please read this article.
Understanding and using APPLY, (I) and (II) Paul White
Hidden RBAR: Triangular Joins / The "Numbers" or "Tally" Table: What it is and how it replaces a loop Jeff Moden
February 26, 2009 at 5:32 am
Viewing 15 posts - 8,746 through 8,760 (of 10,143 total)