Viewing 15 posts - 5,506 through 5,520 (of 10,144 total)
You're better off using inline table-valued functions. Here's an example:
ALTER FUNCTION [dbo].[iTVF_Tester]
(@jdt_jty_code varchar(50))
RETURNS TABLE AS RETURN
SELECT ReturnValue
FROM (VALUES
('ISCO','Install'),
('ISSP','Install'),
('IECO','Install'),
('IECM','Install'),
('IESP','Install'),
('IEHD','Install'),
('ISHD','Install'),
('FRSI','Install'),
('SB42','Service Call'),
('SB4W','Service Call'),
('HD42','Service Call'),
('HD4W','Service Call'),
('SA2C','Service Call'),
('SA2W','Service Call'),
('HD2C','Service Call'),
('HD2W','Service Call'),
('SNCO','Service Call')
) x...
October 2, 2012 at 7:19 am
Roland Alexander STL (10/2/2012)
You're getting an error because the CASE statement needs to be enclosed in parentheses.
I'm unaware of this as a requirement in TSQL.
I think it's more likely because...
October 2, 2012 at 7:18 am
Select case
When jdt_jty_code IN ('ISCO','ISSP','IECO','IECM','IESP','IEHD','ISHD','FRSI') Then 'Install'
When jdt_jty_code IN ('SB42','SB4W','HD42','HD4W','SA2C','SA2W','HD2C','HD2W','SNCO') Then 'Service Call'
Else 'UNKNOWN' END
October 2, 2012 at 7:04 am
norbert.manyi (10/2/2012)
October 2, 2012 at 7:00 am
If you are using the Enterprise edition of SS2K8, then change data capture is well worth a look.
October 2, 2012 at 5:12 am
-- you have 2 rows for sector 'A', month 1
-- what do you want to do with them?
-- It's not clear from your "Required Output", which...
October 2, 2012 at 4:51 am
HowardW (10/2/2012)
Have to say, getting increasingly irate about e-book pricing. Why do I have to pay 50p more, given all the costs of printing, distributing and...
October 2, 2012 at 4:11 am
gianlud75 (10/2/2012)
...What I would like to get, is something like the image in attachment
You have to use dynamic sql for this. The core query is this:
SELECT
a.SURV_ID,
[First Question] =...
October 2, 2012 at 4:00 am
deepakagarwalathome (10/1/2012)
...There are no indexes on any of the tables...
This might have something to do with it. The first sentence of an excellent indexing article[/url] reads "Indexes are fundamental to...
October 2, 2012 at 3:16 am
jmccoy-1028380 (10/1/2012)
Are there other ways though, for evaluating it?
--something like:
IF isnull(@OrderNumRtrn, 0) = 0 OR @OrderNumRtrn = '000000'
...
October 2, 2012 at 2:33 am
d.aarts (10/2/2012)
October 2, 2012 at 2:15 am
Mixolydian (10/1/2012)
Lowell, thank you for the valuable tip. I do need to check...
October 2, 2012 at 2:05 am
dwain.c (10/1/2012)
ChrisM@Work (9/28/2012)
dwain.c (9/27/2012)
I think this is a pretty snappy query too.
<<snip>>
Chris - I like what you did with the CROSS APPLY and I was able to do that in...
October 1, 2012 at 9:02 am
laurie-789651 (10/1/2012)
laurie-789651 (10/1/2012)
I've elected to show rows where both values are zero in case these are wrong - You can remove this if you want.
I've set MAXRECURSION...
October 1, 2012 at 6:29 am
This will get you 1 and 2:
DROP TABLE #tblHTML
CREATE TABLE #tblHTML (RowID INT, strPage ntext)
INSERT INTO #tblHTML (RowID, strPage)
SELECT
1, REPLICATE(CAST('I have a table [tblHTML] with an ntext column [strPage]...
October 1, 2012 at 5:56 am
Viewing 15 posts - 5,506 through 5,520 (of 10,144 total)