Viewing 15 posts - 1,006 through 1,020 (of 3,957 total)
Here's another suggestion:
WITH Table1 (ID, Val) AS
(
SELECT 201220, 0.5
UNION ALL SELECT 201219, 0.4
UNION ALL SELECT 201218, 0.4
)
...
December 16, 2013 at 5:28 pm
Steve Jones - SSC Editor (12/16/2013)
It snowed last week, still snow on the ground, but supposed to hit 60F...
December 16, 2013 at 5:17 pm
Are you perhaps looking for something like this?
WITH SampleData (Times, ACD, Other) AS
(
SELECT CAST('08:30' AS DATETIME), -12, -10
UNION ALL SELECT CAST('09:00' AS DATETIME), -48, -0
UNION ALL SELECT...
December 15, 2013 at 5:52 pm
It appears that Monday morning without coffee isn't particularly conduciveto understanding requirements, so post removed.
December 15, 2013 at 5:36 pm
pietlinden (12/12/2013)
I think storing information using this...
December 13, 2013 at 12:12 am
Perhaps it is just a recommendation:
We recommend that you use catalog views because they are the most general interface to the catalog metadata and provide the most efficient way to...
December 12, 2013 at 7:25 pm
happycat59 (12/12/2013)
dwain.c (12/12/2013)
jshahan (12/12/2013)
You can also query information_schema.columns.select * from information_schema.columns where table_name = 'YourTableName'
Better to use sys.columns or sys.all_columns as information_schema.columns is being deprecated.
All the technical metadata exists in...
December 12, 2013 at 7:21 pm
jshahan (12/12/2013)
You can also query information_schema.columns.select * from information_schema.columns where table_name = 'YourTableName'
Better to use sys.columns or sys.all_columns as information_schema.columns is being deprecated.
All the technical metadata exists in there. ...
December 12, 2013 at 6:09 pm
John Mitchell-245523 (12/12/2013)
Have you looked at the new LAG and LEAD windowing functions?John
I agree with John that LAG would be pretty good for this:
WITH Aggregates AS
(
SELECT...
December 12, 2013 at 6:01 pm
You might want to take a look at this article:
Condensing a Delimited List of Integers in SQL Server[/url]
Somewhere buried deep into it (perhaps 2/3s of the way down if I...
December 12, 2013 at 5:30 pm
I have to agree with earlier posters that you don't need dynamic SQL for this, but let's assume that we can't see everything you do and it is really needed...
December 12, 2013 at 5:23 pm
Is this what you're looking for?
WITH SampleData (dur_nano) AS
(
SELECT CAST(163691964 AS BIGINT)
)
SELECT dur_nano
,millseconds=(dur_nano/1000000)
,microseconds=(dur_nano/1000)%1000
,nanonseconds=dur_nano%1000
FROM SampleData;...
December 12, 2013 at 5:12 pm
You should wrap your UPDATEs/INSERT/MERGE in a TRANSACTION and then do COMMIT/ROLLBACK consistent with your error handling.
December 12, 2013 at 5:06 pm
Or you can skip creating the table all together and use a calendar generating FUNCTION instead:
CREATE FUNCTION [dbo].[GenerateCalendar]
(
...
December 12, 2013 at 5:01 pm
ChrisM@Work (12/12/2013)
-- I might give it a go over lunch.
----------------------------------------------------------------------------------------
I can see it now. Cornish pasty in one hand while the other furiously types in the 1M row test...
December 12, 2013 at 3:30 am
Viewing 15 posts - 1,006 through 1,020 (of 3,957 total)