Viewing 15 posts - 3,181 through 3,195 (of 5,588 total)
Craig Farrell (9/15/2010)
sql.abhishek (9/15/2010)
I am desperately looking for some piece of code to get this type of out put .... kindly help me out of this.
For the code, you'll really...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 2:42 pm
You're quite welcome. Glad I could help.
jeff.mason (9/15/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 2:25 pm
Derrick Smith (9/15/2010)
You mean you want to pull the two most recent orders for each product, sorted by OrderDate, and then display the corresponding OrderNumber, right?
FelixG (9/15/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 2:10 pm
jeff.mason (9/15/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 2:03 pm
Something like this should get the top two of each:
DECLARE @Orders TABLE (ProductCode int, OrderDate datetime, OrderNumber varchar(5));
INSERT INTO @Orders
SELECT 1, '20100915', '11112' UNION ALL
SELECT 1, '20100823', '11122' UNION ALL
SELECT...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 2:00 pm
Yes.
select t1.*
from dbo.table1 t1
LEFT JOIN dbo.table2 t2
ON t1.col1 = t2.col1
...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 1:50 pm
jeff.mason (9/15/2010)
I think I am going to kill that developer tomorrow....
Why wait that long? A 5 minute start is all he should get... :w00t:
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 1:47 pm
Craig Farrell (9/15/2010)
WayneS (9/15/2010)
Craig Farrell (9/15/2010)
[EDIT:] Heheh, Wayne, fastest code gun in the west. 🙂 [/EDIT]Maybe, but sometimes it's draw,shoot,aim instead of aim,shoot,draw... heh, wait-a-minute... :crazy:
And thus, we find...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 1:41 pm
INSERT INTO dbo.ContractItems
(
Trading_Partner_ID,
Corp_Item_Num,
ContractID,
IsRebateEligible,
ChangedDate,
ChangedUser
)
SELECT
cs.Corp_Item_Num,
cs.Trading_Partner_ID,
ContractID,
0 IsRebateEligible,
GETDATE() ChangedDate,
SUSER_SNAME() ChangedUser
Are the items in bold in the wrong order?
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 1:37 pm
Wouldn't you use DT_DBDATE instead of DT_DBTIMESTAMP? Also, try replacing the "/" with "."
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 1:30 pm
Craig Farrell (9/15/2010)
[EDIT:] Heheh, Wayne, fastest code gun in the west. 🙂 [/EDIT]
Maybe, but sometimes it's draw,shoot,aim instead of aim,shoot,draw... heh, wait-a-minute... :crazy:
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 1:08 pm
Hey you'll...
I know a lot of people don't like Joe Celko's online personna. You might be interested in how his tone changed in this thread after it was discovered the...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 11:07 am
No problem - glad I could help.
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 11:02 am
Eric Russell 13013 (9/15/2010)
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 10:58 am
Since this is a character field, what happens to a date that just happens to contain a zero (like year 2010, or days 10, 20, 30)? You might need to...
Wayne
Microsoft Certified Master: SQL Server 2008
Author - SQL Server T-SQL Recipes
September 15, 2010 at 10:47 am
Viewing 15 posts - 3,181 through 3,195 (of 5,588 total)