Viewing 15 posts - 2,326 through 2,340 (of 7,191 total)
September 6, 2016 at 8:55 am
I think unless you change the design of your database, this is always going to be a bit flaky. However, this will work for the data you posted:
WITH Inners...
September 5, 2016 at 10:00 am
There are pros and cons. Your query will return (possibly) unexpected results if there are gaps in the data or two dates in the same week. But yes,...
August 26, 2016 at 9:28 am
Actually, DENSE_RANK would probably be a better choice than ROW_NUMBER. That way, if for any reason you have two dates that are in the same week, they won't appear...
August 26, 2016 at 9:14 am
SELECT
Time_Started
,ROW_NUMBER() OVER (ORDER BY DATEPART(wk,Time_Started)) AS Week_No
FROM #tbl_data
John
August 26, 2016 at 8:46 am
Prakash
What question are you asking here - how to do running totals, or how to change how they're partitioned at run time?
The answer to the first question is to use...
August 26, 2016 at 5:24 am
Ah yes. My mistake. I've edited the offending post.
John
August 26, 2016 at 2:05 am
No, but you can query sys.partitions to get the rows per table in a database, and use something like sp_MSForEachDB to loop through all databases and execute the same query.
John
August 25, 2016 at 8:51 am
Rushi
What security model are you using on your data source? It sounds if you're connecting as your own Windows login. If that's the case, the most likely explanation...
August 24, 2016 at 9:58 am
You can't disable a Windows login, but you can revoke the CONNECT permission.
John
August 24, 2016 at 9:50 am
What do you get if you run this?SELECT
o.name AS TableorViewName
,c.name AS ColumnName
,t.name AS TypeName
,c.max_length
FROM sys.indexes i
JOIN sys.objects o ON i.object_id = o.object_id
JOIN sys.index_columns ic ON i.object_id = ic.object_id AND...
August 24, 2016 at 8:51 am
Does this help? I found it by typing the title of your post into a search engine.
John
August 24, 2016 at 4:27 am
Yes. Join to sys.index_columns, sys.indexes and sys.types.
John
August 22, 2016 at 5:54 am
What do you get if you run this?
EXEC xp_fixeddrives
John
August 22, 2016 at 5:49 am
Join sys.indexes to sys.objects. You'll need to do that in every database (or use sp_MSForEachDB), though, if you don't know what database the index is in.
John
August 22, 2016 at 4:58 am
Viewing 15 posts - 2,326 through 2,340 (of 7,191 total)