Viewing 15 posts - 1,171 through 1,185 (of 7,191 total)
raghuldrag - Wednesday, October 25, 2017 3:45 AMmy query is working fine
No it isn't, because it won't even parse. Please post DDL...
October 25, 2017 at 4:08 am
Naveen
Your query is joining (what looks like) two views, and from the picture you've posted, I'd say that each of those views in turn contains several joins.
October 25, 2017 at 4:03 am
Where clause looks wrong. OP wants all data from 23:00 to 7:00...
October 25, 2017 at 3:16 am
ramrajan - Monday, October 23, 2017 8:43 AMeven after including the group by it is not giving the right result.
Show us the...
October 23, 2017 at 8:47 am
No, like I said, let's get the row counts right before we look at the indexes. Why did you change index_id IN (0,1) to index_id NOT...
October 23, 2017 at 8:30 am
ramrajan - Monday, October 23, 2017 3:53 AMCan you please share the complete query instead of just half ?
No. We're not here...
October 23, 2017 at 3:54 am
Here's how to get a row count for each table:SELECT
object_id
, SUM(rows) AS NoofRows
FROM sys.partitions
WHERE index_id IN (0,1) -- clustered index or heap
October 23, 2017 at 3:49 am
Don't bother with sp_MSforeachtable. Join to sys.partitions instead - that has a column with the row count in it. Start by returning a result set with a row count for...
October 23, 2017 at 3:35 am
Yes, of course. Show me what you've tried, and I'll give you some pointers.
John
October 23, 2017 at 3:20 am
If it works, and you've tested it on large (say million-plus rows) data sets and it performs well, then go with it. If you're going to be using dynamic SQL...
October 23, 2017 at 2:41 am
Sounds a little bit like a homework question. Be that as it may, you need to join the sys.tables, sys.indexes and sys.partitions catalog views to solve this problem. Have a...
October 23, 2017 at 2:36 am
Here you go. Not tested.
-- This relies on there being no gaps or repititons in the ID column.
-- If there are, you'll need to number...
October 20, 2017 at 8:49 am
Time for you to provide table DDL in the form of a CREATE TABLE statement, sample data in the form of INSERT statements and expected results based on the sample...
October 20, 2017 at 7:23 am
Use a CTE to get row numbers partitioned by ID and Group and ordered by date (descending), then select from that CTE where the row number is 1.
John
October 20, 2017 at 5:33 am
Indeed. And please make sure you read and understand about SQL injection before that goes anywhere near a live server.
John
October 20, 2017 at 2:10 am
Viewing 15 posts - 1,171 through 1,185 (of 7,191 total)