Viewing 15 posts - 676 through 690 (of 1,439 total)
WITH CTE AS (
SELECT *,
ROW_NUMBER() OVER(PARTITION BY id, order_status
...
January 30, 2012 at 10:09 am
Maybe this?
WITH CTE AS (
SELECT company,details,details2,
ROW_NUMBER() OVER(PARTITION BY company,details
...
January 30, 2012 at 4:22 am
WITH CTE AS (
SELECT col1,col2,[date],
COUNT(*) OVER(PARTITION BY col2,[date]) AS num
FROM mytable)
SELECT col1,col2,[date]
FROM CTE
WHERE num>1;
January 30, 2012 at 3:36 am
Not sure what you mean by one statement only but this looks like straightforward aggregation using GROUP BY
SET DATEFORMAT DMY
DECLARE @t TABLE([date] DATETIME,acode INT,bcode CHAR(3),amt FLOAT)
INSERT INTO @t([date],acode,bcode,amt)
SELECT '14/09/2011',6019,'002',1427.1969 UNION...
January 27, 2012 at 3:49 am
This is the nearest I could come up with - it works with your sample data but you'll need to try this with a larger data set.
WITH CTE AS (
SELECT...
January 25, 2012 at 9:10 am
Try changing
a.xmlcontent.value('/Report/DataSources/DataSource/DataSourceReference','varchar(max)')
to
a.xmlcontent.value('/Report/DataSources/DataSource/DataSourceReference[1]','varchar(max)')
January 25, 2012 at 1:14 am
Maybe I'm just missing something here, but can't you join on the partial path using LIKE
SELECT m.[Path],p.UserName,p.AccessLevel,p.Path,
ROW_NUMBER() OVER(PARTITION BY m.[Path] ORDER BY LEN(p.[Path]))...
January 23, 2012 at 6:33 am
DECLARE @t TABLE(DateValue datetime,Value int)
INSERT INTO @t(DateValue,Value)
SELECT '20120102',0 UNION ALL
SELECT '20120103',1 UNION ALL
SELECT '20120104',1 UNION ALL
SELECT '20120105',1 UNION ALL
SELECT '20120106',1 UNION ALL
SELECT '20120107',1 UNION ALL
SELECT '20120108',0 UNION ALL
SELECT '20120109',1 UNION...
January 23, 2012 at 6:22 am
Use the XML exist method
DECLARE @t TABLE (xmlfield XML)
INSERT INTO @t(xmlfield)
VALUES('
<root>
<AList>
<DeliveryNameAddresses>
<DelivN1>
...
January 20, 2012 at 8:12 am
GrassHopper (1/19/2012)
Can yo please explain what AND type='P' is ?
and how does Number work? ...
January 19, 2012 at 9:24 am
roryp 96873 (1/19/2012)
January 19, 2012 at 9:12 am
Using a numbers/tally table
DECLARE @t TABLE (Data VARCHAR(1000))
INSERT @t (Data)
VALUES ('2:42 1/29 On R.P.C resolved vendor was instructed on Friday failed to send 2020817 813 811 810 806 796...
January 19, 2012 at 8:56 am
If you can change the INSERT, you don't need the trigger at all
INSERT INTO Customer(CustomerId,Name,Value,Percentage)
SELECT CustomerId,Name,Value,dbo.GetPercentage(Value)
FROM CustomerTemp
January 18, 2012 at 2:01 am
Try this
WITH CTE1 AS (
SELECT job, oper_num, wc, move_hrs,
ROW_NUMBER() OVER(PARTITION BY job ORDER BY oper_num) -
...
January 17, 2012 at 9:45 am
bicky1980 (1/16/2012)
With ChrisM's help, I think I now have the solution:
CREATE TABLE #test2 (indkey NVARCHAR(2), ...
January 16, 2012 at 9:14 am
Viewing 15 posts - 676 through 690 (of 1,439 total)