Viewing 15 posts - 841 through 855 (of 898 total)
:-)And i hope you understood why it failed..
If you didn't, have a look at the following link
http://www.sqlservercentral.com/blogs/never_say_never/archive/2010/1/28/in-and-not-in.aspx
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 18, 2010 at 6:13 am
Check if this the below code returns any NULL values
SELECT ID FROM @TempTable
If it does your first query will fail..
And posting some sample data along with your table structure will...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 18, 2010 at 5:37 am
This will be a useful link for you..
http://www.sqlservercentral.com/articles/SQL+Server+2008/65539/
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 17, 2010 at 6:20 am
Glad i could help you out:-)
Look for the explanation of ROW_NUMBER in Books Online. You can also Google for some good examples on the same.
You can also play with the...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 16, 2010 at 2:04 am
Just add the column Section in the PARTITION BY Clause as shown below
ROW_NUMBER() OVER ( PARTITION BY EmployeeID, Section ORDER BY T1.StartDate DESC ) Row
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 16, 2010 at 1:42 am
Glad that i could help you out:-)
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 16, 2010 at 1:37 am
This should help..
CREATE TABLE TestTable
(
page_idINT,
parent_idINT,
page_titleVARCHAR(50)
)
DECLARE@strSQL VARCHAR(MAX)
DECLARE@iPageID INT
SET@iPageID = 5
INSERT TestTable
SELECT 1, 0, 'Home' UNION ALL
SELECT 2, 1, 'Park' UNION ALL
SELECT 3, 1, 'Library' UNION ALL
SELECT 4, 3, 'Library2' UNION ALL
SELECT...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 16, 2010 at 12:45 am
Not sure about the performance aspect. But this will help you avoid certain problems that are mentioned in the following link
http://www.sqlservercentral.com/blogs/never_say_never/archive/2010/1/28/in-and-not-in.aspx
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 15, 2010 at 11:42 pm
Then, you can't replace your above statements with a single statement.
But i can give you a better way of doing the update without using the #C and which will not...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 15, 2010 at 11:13 pm
What is the purpose of creating the temporary table #C? Are you using it anywhere else other than your second statement?
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 15, 2010 at 10:40 pm
I didn't test but this should work..
; WITH cteTableDetails AS
(
SELECT ROW_NUMBER() OVER ( PARTITION BY EmployeeID ORDER BY T1.StartDate DESC ) Row, T1.*
FROM Table1...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 15, 2010 at 10:26 pm
smknox (3/12/2010)
Insert Into Table2 ...
Insert Into Table3 ...
Insert Into Table4 ...
From here I want to continue with updates to tables based on a...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 12, 2010 at 9:28 pm
SELECTCOUNT(*)
FROM(
SELECT DATENAME( MONTH, DATEADD( DAY, N - 1, @sdtStartDate ) ) Col1, COUNT(*) Col2
FROM dbo.Tally
WHERE ...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 11, 2010 at 10:05 pm
Try this one..
DECLARE@tblTable TABLE
(
DateFromSMALLDATETIME,
DateToSMALLDATETIME
)
INSERT@tblTable
SELECT'04 January 2010', '03 February 2010' UNION ALL
SELECT'06 January 2010', '05 February 2010' UNION ALL
SELECT'26 January 2010', '25 February 2010' UNION ALL
SELECT'01 February 2010', '03 March 2010'...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 10, 2010 at 6:05 am
What would be the expected result if you have data similar to this???
DECLARE@tblTable TABLE
(
Day1 INT,
Day2 INT,
Day3 INT,
Day4 INT,
...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
March 9, 2010 at 9:48 pm
Viewing 15 posts - 841 through 855 (of 898 total)