Viewing 15 posts - 586 through 600 (of 1,439 total)
I think you can use CUBE/ROLLUP for this.
SELECT CASE WHEN n1.strcol IS NULL THEN 0 ELSE 1 END +
CASE WHEN n2.strcol...
May 17, 2012 at 9:47 am
CELKO (5/16/2012)
Gee, ANSI/ISO Standards, etc are "high horse" to you? Does that say a lot about your professionalism and expertise...
May 17, 2012 at 7:30 am
Use LIKE
SELECT ..
FROM mytable
WHERE PartNumber LIKE '[0-9][0-9][0-9][0-9][A-Za-z][0-9][0-9]'
May 16, 2012 at 8:25 am
Bit weird but works...
select
'A' as [value],
null as [x],
'B' as [value]
for xml path('test'), type
May 16, 2012 at 3:29 am
This sort of things is straightforward as a SQLCLR, something like this
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Text;
public partial class UserDefinedFunctions
{
enum States { Literal, UpperNext, LowerNext...
May 15, 2012 at 10:03 am
With a minor change, the cross apply code runs a lot quicker.
Here's my test set up
SET STATISTICS TIME OFF
DECLARE @x XML
SELECT @x = '<EXPORT>
<UNIT UNIT_ID="40001" TYPE="01">
...
May 9, 2012 at 9:44 am
This should be quicker
select b.value('@UNIT_ID', 'nvarchar(100)'),
r.value('@DT', 'DATETIME'),
r.value('@V', 'decimal(10, 8) ')
from...
May 8, 2012 at 9:56 am
Try this
with cte as (
select *,
row_number() over(partition by empno,cid order by enddate desc) as rn
from temptable)
delete from cte where rn>1;
May 8, 2012 at 7:08 am
UPDATE #test
SET string = dbo.RegexReplace(dbo.RegexReplace(string, '[0-9]', '9'), '[a-zA-Z]', 'X')
FROM #test
May 8, 2012 at 3:41 am
Sean Lange (5/3/2012)
Lynn Pettis (5/3/2012)
SSC is at 1,499,895 and counting!Wow if the same rate continues we should hit 1.5M by the end of the day today or certainly tomorrow.
Now standing...
May 4, 2012 at 1:54 am
Join to a numbers/tally table
SELECT s.ORDER_NUMBER, s.PRODUCT_ID, 1 AS QTY, s.VALUE/s.QTY AS VALUE
FROM @SPLITROW s
INNER JOIN master.dbo.spt_values t ON t.type='P'
AND t.number BETWEEN 1...
May 3, 2012 at 3:14 am
See if this helps
SELECT col1,col2,col3,
LEN(col3)-LEN(REPLACE(col3,'A','')) AS NumberOfA,
LEN(col3)-LEN(REPLACE(col3,'B','')) AS NumberOfB
FROM tbl1
May 2, 2012 at 7:00 am
dilip.aim11 (4/26/2012)
hi yes i have variable number of till..which i am getting in variable ... using
count statement from other table...
Have a look at dynamic cross tabs here
April 26, 2012 at 7:58 am
SELECT Sales,
SUM(CASE WHEN Till=1 THEN Amount ELSE 0 END) AS Till1,
SUM(CASE WHEN Till=2 THEN Amount ELSE...
April 26, 2012 at 7:49 am
Still not really clear what you're asking for
SELECT resp_Id, Brand, [Year], [Month], FOP = MAX(CASE WHEN [Week]=2 THEN 1 ELSE 0 END) +
...
April 25, 2012 at 7:03 am
Viewing 15 posts - 586 through 600 (of 1,439 total)