Viewing 15 posts - 1 through 15 (of 168 total)
Try using IIF construct, Please remember you have to Microsoft Jet Database syntax while querying excel
SELECT CVV_CODE, CVV_OMSCHR
,IIF((STARTD_CVV='-'),NULL,STARTD_CVV) AS S
FROM [sheet1$]
June 9, 2010 at 2:08 am
CHECK THIS
DECLARE @Table1 TABLE (ID INT , Employee VARCHAR(50))
DECLARE @Table2 TABLE (SourceFieldChar CHAR(1),Val CHAR(1) )
INSERT INTO @Table1
SELECT 1,'Ritesh' UNION ALL
SELECT 2, 'Bhatt'
INSERT INTO @Table2
SELECT 'R','X' UNION ALL
SELECT 'i', 'Y' ...
June 8, 2010 at 6:05 am
check this topic
http://www.sqlservercentral.com/Forums/Topic411310-338-1.aspx
June 8, 2010 at 2:04 am
My bad, Its CROSS APPLY... on a side note even CROSS JOIN will fare better than CROSS APPLY
June 4, 2010 at 9:17 pm
Thank you for proving my argument:-)
June 4, 2010 at 8:11 am
Another assumption .. 🙂
I think he need this
SET ANSI_NULLS ON
SET ANSI_WARNINGS ON
SET ANSI_PADDING ON
GO
DECLARE@Sample TABLE
(
Code VARCHAR(20) NOT NULL
)
INSERT INTO @Sample
SELECT '22G' UNION
SELECT '10A' UNION
SELECT '45B'
SELECT LEFT(Code,PATINDEX('%[a-z]%',Code)-1) AS NUM1,SUBSTRING(Code,PATINDEX('%[a-z]%',Code),LEN(Code))...
June 4, 2010 at 8:01 am
Check this sample, modify according to your requirement
SET ANSI_NULLS ON
SET ANSI_WARNINGS ON
SET ANSI_PADDING ON
GO
DECLARE@Sample TABLE
(
Code VARCHAR(20) NOT NULL
)
INSERT INTO @Sample
SELECT 'Sachin,123'
DECLARE@xml XML
SELECT@XML = CAST('<Gopi>' + REPLACE(Code, ',', '</Gopi><Gopi>') +...
June 4, 2010 at 6:33 am
ColdCoffee,
Here the reason for the error message he received is whenever there is no '-' found in the string then CHARINDEX('-', @FieldName)-1 will return -1 , which throughs an...
June 4, 2010 at 2:48 am
Try this
DECLARE @FieldName VARCHAR(50)
SET @FieldName='E01234/1-1';
SET @FieldName='E01234/11';
SELECT SUBSTRING(@FieldName, 1, CASE WHEN CHARINDEX('-', @FieldName) > 0 THEN CHARINDEX('-', @FieldName)-1
ELSE LEN(@FieldName)
END)
June 4, 2010 at 2:45 am
Add "" before void in your URL
June 4, 2010 at 2:11 am
That's good, but I don't think we can safely hard-code the IdCol values like that. I'm pretty sure there are more than 5 records...
Agreed, Alternatively we can find maximum Emails...
June 3, 2010 at 6:28 am
Alternative Solution
UPDATE #TempA
SET AlternateEmail=
LEFT(B.ALT,LEN(B.ALT)-1)
FROM
(
SELECT Customer_Full_Name,
CASE WHEN ISNULL([1],'')='' THEN ''
ELSE [1]+',' END
+CASE WHEN ISNULL([2],'')='' THEN ''
ELSE [2]+',' END
+CASE WHEN ISNULL([3],'')='' THEN ''
ELSE [3]+',' END
+CASE WHEN ISNULL([4],'')='' THEN ''
...
June 3, 2010 at 5:11 am
Modifed Bhuvanesh's solution to output correct results
declare @t table (ScoreID INT, User1 nvarchar(30), Score int)
insert into @t
select 1,'paul', 10 union
select 2,'paul', 5 union
select 3,'paul',...
June 1, 2010 at 5:15 am
slightly better version of your function
CREATE FUNCTION [dbo].[fn_GopiRecNumberSubject] ( @RecNo CHAR(7) )
RETURNS VARCHAR(1024)
AS BEGIN
DECLARE @ReturnValue VARCHAR(1024),@RecNo CHAR(7)
SELECT @ReturnValue = COALESCE(@ReturnValue, '') + [Subject] + ','
FROM View_RecNumberSubject WHERE Recnumber=@RecNo;
RETURN Left(@ReturnValue,Len(@ReturnValue)-1)
END...
May 31, 2010 at 8:31 am
Viewing 15 posts - 1 through 15 (of 168 total)