Viewing 15 posts - 391 through 405 (of 895 total)
You can use ROW_NUMBER() to achieve the desired results
SELECT*
FROM(
SELECTROW_NUMBER() OVER ( PARTITION BY Client.ID, Patient.SSN ORDER BY StartOfCare ) AS RN,
Client.ID, Client.ClientName, Patient.ClientID, Patient.SSN, Patient.StartOfCare, Patient.PrimDiag
FROMClient Client
INNER JOIN Patient Patient...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 19, 2013 at 12:26 am
This should help you
DECLARE@table TABLE
(
IDINT,
StartDateDATETIME,
EndDateDATETIME
)
INSERT@table( ID, StartDate, EndDate )
SELECT1, '2013-02-17 10:33:10', '2013-02-17 20:14:40' UNION ALL
SELECT1, '2013-02-13 12:42:55', '2013-02-14 14:30:50' UNION ALL
SELECT1, '2013-02-12 15:04:32', '2013-02-15 12:22:25' UNION ALL
SELECT1, '2013-02-16 20:08:18', '2013-02-18...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 18, 2013 at 5:52 am
Jeff Moden (2/15/2013)
I suppose consistency is a good reason. But, let's try something just for fun. Write some code to add 41:41:41.041 to a given date.
My version
DECLARE@date DATETIME
SET@date...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 18, 2013 at 2:39 am
Compassionate (2/5/2013)
i have 10 to 20 tables to be joined to get required results but i heard joins on so many tables is not an ideal option. could you tell...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 6, 2013 at 12:30 am
bhushan_juare (2/4/2013)
I Have table where it includes fields model_size, model_type, actual_qty, process_qty, order_type. Now I want to display all fields + model_size who has order_type = 'Some X'...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 5, 2013 at 2:31 am
If you are confused, ask the question in the forum that seems best fit according to you
As far as your question is concerned, I think you can ask your question...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 4, 2013 at 5:23 am
Great Question. But the link provided has no information specific to this behavior.
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
February 1, 2013 at 12:03 am
You did not get any results because you probably did not have records in table "Tickets" where "Reported_by = Assign_to"
SELECTUsersTbl.Name AS first, UsersTbl.Name AS second
FROMTickets
INNER JOINUsersTbl ON Tickets.Reported_by = UsersTbl.Id...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 28, 2013 at 3:04 am
A nanosecond (ns) is one billionth of a second (10-9 or 1/1,000,000,000 s)...( From Wikipedia http://en.wikipedia.org/wiki/Nanosecond )
As an example, a variable with data type TIME may store a data like...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 28, 2013 at 12:41 am
tom.moore.777 89426 (1/23/2013)
Can anyone provide a method to loop through a DB's in an instance WITHOUT using the proc sp_MSforeachdb
Any particular reason for avoiding the use of sp_MSforeachdb?
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 23, 2013 at 11:57 pm
You can implement this with Dynamic SQL as well
DECLARE@TableName VARCHAR(100), @sql VARCHAR(1000)
SET@TableName = 'agent'
SET@sql= ' SELECT* '
+ ' FROM ' + @TableName
+ ' WHERE ' + CASE WHEN @TableName IN...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 15, 2013 at 3:25 am
scotdg (1/10/2013)
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 10, 2013 at 11:47 pm
venki83k (1/8/2013)
I am executing this against database i got above error .
Basically using this to track db growth of all database on a server.colud you please suggest anybody on...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 9, 2013 at 5:31 am
dineshbabus (1/3/2013)
oh.. unique constraint can allow more than one null value.. I don't think so.. Please give me some xample...
In SQL Server 2008, there is a concept of filtered indexes.
You...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
January 3, 2013 at 10:57 pm
You can look up INNER JOIN and GROUP BY Google or Books Online
Using these two concepts, you can get the desired result
If you face any further issues get back to...
How to post data/code on a forum to get the best help - Jeff Moden
http://www.sqlservercentral.com/articles/Best+Practices/61537/
December 3, 2012 at 7:38 am
Viewing 15 posts - 391 through 405 (of 895 total)