Viewing 15 posts - 226 through 240 (of 1,479 total)
You can use the row_number() function. Here is one way of doing it:
WITH MyCTE AS (
select MasterId, DetailId, ProductQty, ROW_NUMBER() OVER (PARTITION BY MasterId ORDER BY ProductQty desc) as...
May 1, 2013 at 7:05 am
This is the way that SQL Server works and I don't think that there is a way to prevent it, but you can get around it, by working with instead...
April 30, 2013 at 9:21 am
Here is another variation:
DECLARE @t TABLE(Parent int, Child int)
INSERT INTO @t(Parent,Child)
VALUES
(300001,110081),
(300001,102157),
(300001,102158),
(300001,102159),
(110081,101000),
(110081,101504),
(110081,102129);
Declare @Root int
set @Root = 300001;
WITH Recur AS (
SELECT Parent,Child, 1 as Level
FROM @t
WHERE Parent = @Root
UNION ALL
SELECT...
April 30, 2013 at 7:01 am
Here is one way of doing it:
select Col1,Col2
from MyTable
where DateCol > dateadd(hh,8,(dateadd(dd,datediff(dd,'20100101',getdate()),'20100101')))
and DateCol < dateadd(hh,10,(dateadd(dd,datediff(dd,'20100101',getdate()),'20100101')))
Adi
April 30, 2013 at 4:40 am
If I understood what you want, then you can use sub queries that create XML. Notice that when you do it you have to use the directive type (If...
April 29, 2013 at 11:08 am
Can you post also a small script that creates the table and insert test data? Without it I don't think that anyone will be able to help you with...
April 29, 2013 at 9:46 am
Could it be that Mgr_List_Role is a view and not a table? If so you might want to check the view it self.
Adi
April 24, 2013 at 8:47 am
If you want to get members of database role you can use the fallowing query:
select Users.name as UserName, Roles.name as RoleName
from sys.database_role_members drm inner join sys.database_principals Users on drm.member_principal_id =...
April 24, 2013 at 8:40 am
You can find the data here - http://support.microsoft.com/lifecycle/
Adi
April 3, 2013 at 8:01 am
This is a double post. The same question was answered at http://www.sqlservercentral.com/Forums/Topic1438316-146-1.aspx?Update=1. Pleas don't post to this thread.
Adi
April 3, 2013 at 7:44 am
April 3, 2013 at 7:40 am
Actually the only caveat is that you store dates as strings. When you store the dates as datetime you can specify the exact style that should be used...
April 2, 2013 at 8:42 am
In your backup command you use the option NOINIT. This instructs the server not to overwrite the backup file, so each day you keep the old backups and then...
April 2, 2013 at 8:17 am
theashishtrivedi (4/2/2013)
Also, the 2 bytes VARCHAR is using to store length of string is consuming disk space but not affecting the performance.
But still...
April 2, 2013 at 7:16 am
Viewing 15 posts - 226 through 240 (of 1,479 total)