Viewing 5 posts - 31 through 35 (of 35 total)
Thanks sumit.agrawal, This is what im looking for, but one last thing, what is the purpose of CHARINDEX?
July 20, 2010 at 12:44 am
Hi Sethuraj, The code is working fine, But technically it did not interchange the value of the variable.
DECLARE @Var1 varchar(10),@Var2 varchar(10)
SET @var1='A'
SET @var2='B'
SELECT SUBSTRING(@var1+@var2,CHARINDEX(@var2,@var1+@var2),LEN(@var1+@var2)) AS 'A'
SELECT SUBSTRING(@var2+@var1,CHARINDEX(@var1,@var2+@var1),LEN(@var2+@var1)) AS 'B'
July 20, 2010 at 12:25 am
yes it work! thanks, actually I already did it but in not so good SQL because what I did is that I pass it to a view then use that...
August 12, 2008 at 4:10 am
You can use UNION to combine queries.
ex.
SELECT Name, City FROM Suppliers
WHERE Country = 'Mexico'
UNION SELECT Name, City FROM Customers
WHERE Country = 'Mexico'
July 30, 2008 at 11:55 pm
Viewing 5 posts - 31 through 35 (of 35 total)