Viewing 15 posts - 721 through 735 (of 1,439 total)
Cadavre (11/14/2011)
Mark-101232 (10/5/2011)
DECLARE @x XML
SET @x='<MessageDelivery version="B000">
<ReturnMessage id="3652789340">
<AdC ocean="PACCGL">4815044</AdC>
<MessageStatus code="100" time="2011-09-25 13:43:22">status ok</MessageStatus>
<MessageData>700A20000018C0375494400000</MessageData>
<Flags les="0" app="0" read="1" />
</ReturnMessage>
</MessageDelivery>
'
SELECT x.r.value('local-name(.)','VARCHAR(20)') AS Element,
...
November 14, 2011 at 6:24 am
See if this helps
DECLARE @x XML
SET @x='<p>
<name>
<sur></sur>
<fn>AAA</fn>
</name>
<name>
<sur></sur>
<fn>BBB</fn>
</name>
<name>
<sur></sur>
<fn>CCC</fn>
</name>
</p>
'
SELECT a.b.value('.','VARCHAR(20)')
FROM @x.nodes('/p/name/fn') AS a(b)
November 14, 2011 at 2:37 am
Your second insert needs to be a single SELECT
INSERT INTO TestResult(Total)
SELECT (SELECT CONVERT(VarChar,Count(*) + 1)
...
November 9, 2011 at 9:51 am
You can do this with a local server group in SSMS and a query such as this
SELECT @@VERSION,COUNT(*) As NumberOfDatabases FROM sys.databases
Have a look here
http://www.sqlservercentral.com/articles/Management+Studio+(SSMS)/63650/
November 9, 2011 at 8:48 am
Something like this, using ROW_NUMBER()
WITH CTE AS (
SELECT *,
ROW_NUMBER() OVER(PARTITION BY ProjectID ORDER BY ODD DESC) AS rn
FROM tblxrefProjectMICAP)
SELECT *
FROM...
November 9, 2011 at 8:38 am
Try changing
SELECT
(SELECT n.address1 "Address/AddressLine"
, n.address2 "Address/AddressLine"
FROM customer..cruise_bookings cb
to
SELECT
(SELECT
(SELECT Address FROM (SELECT n.address1 UNION ALL n.address2) d(Address) FOR XML PATH('AddressLine'),TYPE)
FROM customer..cruise_bookings cb
November 8, 2011 at 8:27 am
Something like this?
DECLARE @t TABLE(Col VARCHAR(20))
INSERT INTO @t(Col)
SELECT '5a' UNION ALL
SELECT 'ab45' UNION ALL
SELECT '1230' UNION ALL
SELECT '10B' UNION ALL
SELECT 'BAC7'
SELECT Col
FROM @t
WHERE Col LIKE '[0-9]%[A-Z]%';
November 1, 2011 at 8:13 am
JonFox (10/31/2011)
October 31, 2011 at 9:58 am
Jeff Moden (10/18/2011)
Mark-101232 (10/18/2011)
WITH AllAlpha(Letter) AS (
SELECT CHAR(ASCII('A')+N)
FROM dbo.Tally
WHERE N BETWEEN 0 AND 25)
SELECT (SELECT c.Letter AS "text()"
...
October 19, 2011 at 2:29 am
SQLRNNR (10/18/2011)
Lowell (10/18/2011)
October 18, 2011 at 9:17 am
Using a tally table
WITH AllAlpha(Letter) AS (
SELECT CHAR(ASCII('A')+N)
FROM dbo.Tally
WHERE N BETWEEN 0 AND 25)
SELECT (SELECT c.Letter AS "text()"
FROM AllAlpha...
October 18, 2011 at 6:38 am
A bit obscure but try this
SELECT MerchantID from #tempSort
ORDER BY MerchantID COLLATE SQL_EBCDIC037_CP1_CS_AS
October 12, 2011 at 7:51 am
WITH CTE AS (
SELECT Year, Quarter, Amount, DateCreated ,LastModified, CreateEmployee , LastModifiedEmployee,
ROW_NUMBER() OVER(PARTITION BY Year ORDER BY LastModified DESC) AS rn
FROM #SomeTable1) ...
October 11, 2011 at 9:42 am
Can you give a bit more detail for your expected results. If you're after the min and max per year then this should work.
SELECT Year,
...
October 6, 2011 at 8:51 am
See if this helps
DECLARE @x XML
SET @x='<MessageDelivery version="B000">
<ReturnMessage id="3652789340">
<AdC ocean="PACCGL">4815044</AdC>
<MessageStatus code="100" time="2011-09-25 13:43:22">status ok</MessageStatus>
<MessageData>700A20000018C0375494400000</MessageData>
<Flags les="0" app="0" read="1" />
</ReturnMessage>
</MessageDelivery>
'
SELECT x.r.value('local-name(.)','VARCHAR(20)') AS Element,
x.r.value('./text()[1]','VARCHAR(20)') AS...
October 5, 2011 at 3:07 am
Viewing 15 posts - 721 through 735 (of 1,439 total)