Viewing 15 posts - 7,351 through 7,365 (of 8,731 total)
I need you to post sample data and expected results, because I'm not sure that I understand the problem. To know how to do it, please read the article linked...
December 12, 2013 at 10:13 am
This might help you:
http://en.wikipedia.org/wiki/Orders_of_magnitude_(time)
1 second = 1,000 milliseconds
1 second = 1,000,000 microseconds
1 second = 1,000,000,000 nanoseconds
You'll keep a bigint but you can use any order of magnitude you need.
EDITED after...
December 12, 2013 at 10:11 am
First of all, you should avoid using integers to store dates, even if they are just partial as month and year. You get in lots of trouble when calculating change...
December 12, 2013 at 8:52 am
There's no need to use dynamic code. Here's one option and maybe someone could give a better one because I'm not so sure on its performance with big loads. It's...
December 11, 2013 at 3:09 pm
All the "SELECT 1 UNION ALL" create 10 rows which I later use to create 100 rows with a CROSS JOIN in the next CTE.
I'm using TOP 50 because you...
December 11, 2013 at 12:30 pm
I hope that you're trying to normalize your data permanently because this will give you headaches.
To split data you could use the DelimitedSplit8k. Check the article as it's really interesting.
http://www.sqlservercentral.com/articles/Tally+Table/72993/
WITH...
December 11, 2013 at 11:31 am
A Tally table (or in this case a cteTally) can come to the rescue.
Check the following code and ask for anything that you don't understand.
WITH E1(n) AS(
SELECT 1 UNION ALL...
December 11, 2013 at 10:42 am
gary.morey (12/11/2013)
SELECT *FROM Temp_BigTable
WHERE SSN + PKT + FICE_NBR
NOT IN (
SELECT SSN + PKT + FICE_NBR
FROM shi.raw33
)
I recommend you to read the following article NOT EXISTS vs NOT IN[/url]
December 11, 2013 at 9:14 am
Would this help?
WITH SampleData([EMPID],[EffectiveDate],[PrimaryRater], [PrimaryReviewer])
AS
( --This is sample data
SELECT '12345',convert(datetime,'10/10/2001'),'A12345', 'A67890' UNION ALL
SELECT '12345','07/12/2013','A12345', 'B67890' UNION ALL
SELECT '12345','08/18/2002','A12345', 'C67890' UNION ALL
SELECT '12345','07/17/1966','A12345', 'D67890' UNION ALL
SELECT '12345','01/01/1966','B12345', 'E67890'
)
--Solution starts here
,CTE...
December 10, 2013 at 9:16 pm
I had totally missed the point of the different EndDate for PrimaryRater B12345.
Here's an option:
;WITH MyCTE([EMPID],[EffectiveDate],[PrimaryRater])
AS
( --This is sample data
SELECT '12345',convert(datetime,'10/10/2001'),'A12345' UNION ALL
SELECT '12345','07/12/2013','A12345' UNION ALL
SELECT '12345','08/18/2002','A12345' UNION ALL
SELECT '12345','07/17/1966','A12345'...
December 10, 2013 at 2:46 pm
Are you using SSRS to call tha procedure? SSRS might be changing your variables to the actual values in the query using the Join function. To correctly insert the values,...
December 10, 2013 at 2:23 pm
Just to be clear.
Lowell used the following code as sample data:
;WITH MyCTE([EMPID],[EffectiveDate],[PrimaryRater])
AS
(
SELECT '12345',convert(datetime,'10/10/2001'),'A12345' UNION ALL
SELECT '12345','07/12/2013','A12345' UNION ALL
SELECT '12345','08/18/2002','A12345' UNION ALL
SELECT '12345','07/17/1966','A12345' UNION ALL
SELECT '12345','01/01/1966','B12345'
)
And the following is...
December 10, 2013 at 1:58 pm
Lowell (12/10/2013)
December 10, 2013 at 1:42 pm
Without DDL and sample data, I suppose that you would want a comma separated value for the 'Spec Comp' column. It's explained in this article: http://www.sqlservercentral.com/articles/comma+separated+list/71700/
This should do it, but...
December 10, 2013 at 12:53 pm
The query doesn't seem to haev an error. However, there's something that intrigues me. You're using WHERE offc_code IN (@Offc) and seems that @Offc might be a comma-separated value.
If it's...
December 10, 2013 at 10:25 am
Viewing 15 posts - 7,351 through 7,365 (of 8,731 total)