Viewing 15 posts - 556 through 570 (of 1,439 total)
with cte as (
select row_number() over (partition by identifier, templateid order by CreateDate desc ) as num,
count(*) over (partition by identifier, templateid) as...
July 11, 2012 at 10:03 am
Use the OUTPUT clause
http://msdn.microsoft.com/en-us/library/ms177564(v=sql.90).aspx
July 5, 2012 at 7:47 am
Try this
DECLARE @doc XML
SET @doc ='
<AllocateGiftResult xmlns:a="http://schemas.datacontract.org/2004/07/StockControlServices.Models.Response"
xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.xxx.co.uk/giftmanagement/">
<a:AllocationReference i:nil="true" />
<a:AmpsReference i:nil="true" />
<a:ErrorString>StockRecordNotFound</a:ErrorString>
<a:ResultCode>Error</a:ResultCode>
</AllocateGiftResult>';
WITH XMLNAMESPACES('http://schemas.datacontract.org/2004/07/StockControlServices.Models.Response' AS a,
...
July 3, 2012 at 9:33 am
Try adding
WITH XMLNAMESPACES(DEFAULT 'http://schemas.microsoft.com/sqlserver/2008/sqlaudit_data')
to the start of your query
July 3, 2012 at 5:13 am
ScottPletcher (6/27/2012)
Regarding date formatting, I'd suggest using 'YYYYMMDD', which is foolproof on SQL Server, rather than 'YYYY-MM-DD', which can fail depending on specific settings in SQL...
June 27, 2012 at 3:59 pm
Are you really using SQL Server 2000? If so, this should work but for SQL Server 2005 upwards there are better solutions.
SELECT s.ID, s.PDate, score, code
FROM #mytable S ...
June 27, 2012 at 9:45 am
Try this.
WITH CTE AS (
SELECT HotelId,RoomTypeId ,DateKey ,FreeCount,
ROW_NUMBER() OVER(PARTITION BY HotelId,RoomTypeId
...
June 25, 2012 at 5:06 am
DECLARE @t TABLE(col1 INT, col2 INT)
INSERT INTO @t(col1,col2)
SELECT 1, 1 UNION ALL
SELECT 2, 2 UNION ALL
SELECT 3, -999 UNION ALL
SELECT 4, -999 UNION ALL
SELECT 5, -999 UNION ALL
SELECT 6, 6...
June 21, 2012 at 3:06 am
hitesh-733762 (6/20/2012)
thanks for query BUT what do i do if i were to run this sql on SQL-2000. This report sql should be compatible for 2000 thru 2012.
I don't...
June 20, 2012 at 8:19 am
shubhamagrawal.107 (6/20/2012)
but 10/08/2011 not show in 2 quarter
That's because it's in quarter 3
June 20, 2012 at 6:16 am
Search for "Calendar Table", you may want something like this
SELECT dt,
DATEPART(quarter,dt)
FROM Calendar
WHERE dt BETWEEN '01/04/2011' AND '30/06/2011'
June 20, 2012 at 6:07 am
DECLARE @t TABLE(ID INT, FromID INT)
INSERT INTO @t(ID,FromID)
SELECT 1, 0 UNION ALL
SELECT 2, 1 UNION ALL
SELECT 3, 0 UNION ALL
SELECT 4, 2 UNION ALL
SELECT 5, 3 UNION ALL
SELECT 6, 4;
DECLARE...
June 19, 2012 at 3:54 am
WITH CTE AS (
SELECT empcode,absent_date,
ROW_NUMBER() OVER(PARTITION BY empcode ORDER BY absent_date) AS rn
FROM EMP_ABSENT)
SELECT empcode
FROM CTE
GROUP BY empcode,DATEADD(Day,-rn,absent_date)
HAVING COUNT(*)>=3
June 15, 2012 at 7:47 am
Sony Francis @EY (6/14/2012)
SELECT level
INTO #myTable
FROM(VALUES('1'),('1.1.3'),('1.2.4.4'),('2'),('3.1'),('10.1'),('10.2'),('11.1'),('11.2'),
('13.1'),('3.2'),('4'),('5'),('6'),('7'),('8'),('8.1'),('9'),('14'))a(level);
;WITH cte
AS
(
SELECT [level], ROW_NUMBER() OVER(
PARTITION BY
SUBSTRING ([level], CASE WHEN CHARINDEX('.',[level],0)=0 THEN 1 ELSE 0 END, CASE WHEN CHARINDEX('.',[level],0)=0 THEN LEN([level]) ELSE CHARINDEX('.',[level],0)...
June 14, 2012 at 5:13 am
Viewing 15 posts - 556 through 570 (of 1,439 total)