Viewing 15 posts - 1,096 through 1,110 (of 3,957 total)
Probably something like this.
WITH SampleData (ID, Data) AS
(
SELECT 'A', 'P1' UNION ALL
SELECT 'A', 'P1' UNION ALL
SELECT 'A', 'P2' UNION ALL
SELECT 'A', 'P2' UNION ALL
SELECT 'A', 'P3' UNION ALL
SELECT 'A', 'P4'...
November 18, 2013 at 10:14 pm
Abu Dina (11/18/2013)
Ah! Then you need to be introduced to the INTO Clause 😉
A couple of caveats to using this technique:
- All columns created will default to allow NULL values.
-...
November 18, 2013 at 6:15 pm
Laurence Neville (11/18/2013)
I have to award the prize to mickeyT's solution - it is the fastest of all the contributions.
Thanks everyone ......
November 18, 2013 at 6:05 pm
Old thread but this is my reference article on the subject:
Efficiently Querying and Calculating Using SQL Server Date/Time Columns --by Adam Machanic
Age is covered near the end.
November 18, 2013 at 5:23 pm
A very concise and clear article Wayne.
I've read a number of others on this topic and none came across quite as clear.
Too bad I didn't have this a couple of...
November 18, 2013 at 5:04 pm
ksatpute123 (11/18/2013)
dwain.c (11/17/2013)
DECLARE @temp TABLE(id int, name varchar(50), age int, contact_number varchar(50));
insert into...
November 18, 2013 at 12:34 am
Hold on... rethinking my answer.
November 18, 2013 at 12:29 am
Jeff Moden (11/17/2013)
WayneS (11/17/2013)
November 17, 2013 at 11:00 pm
WayneS (11/17/2013)
November 17, 2013 at 7:26 pm
Tom,
Interesting problem but I can't quite wrap my head around what you're looking for. But here's an rCTE solution that may be something like it.
CREATE TABLE #coinlist (val int,...
November 17, 2013 at 6:47 pm
If contact number is the only column that may have duplicates, you can also do it like this.
DECLARE @temp TABLE(id int, name varchar(50), age int, contact_number varchar(50));
insert into @temp(id,name) select...
November 17, 2013 at 5:24 pm
Laurence Neville (11/15/2013)
November 15, 2013 at 3:47 am
Having looked at your question again, I think I see what you're trying to do.
Not sure how well this will perform but for what it's worth, you can try this:
DECLARE...
November 15, 2013 at 1:59 am
Then how specifically does 2011-04-30 come to be an end date in the expected results?
November 14, 2013 at 8:16 pm
Please ignore the error I reported for MickyT's solution. Copy/paste error.
I'm going back to my previous post to include MickyT's results.
November 14, 2013 at 7:30 pm
Viewing 15 posts - 1,096 through 1,110 (of 3,957 total)