Viewing 15 posts - 196 through 210 (of 683 total)
Since you insist...
declare @ColumnDesc table (ID int, ColumnList varchar(4000))
Insert into @ColumnDesc
Select 1,'Select A.Eno,B.Salary,C.Dept from Emp A,Payroll B,Department C'
Union All Select...
April 21, 2008 at 4:19 am
Another option and my preference is...
DECLARE @Rows TABLE (RowNumber INT IDENTITY(1, 1), Col1 VARCHAR(10))
INSERT @Rows SELECT 'B' UNION ALL SELECT 'A' UNION ALL SELECT 'D'
SELECT a.Col1, a.[Val 1]
FROM @Table a...
April 21, 2008 at 4:03 am
what I have to do is to respect the same order that is in the WHERE Clause
You can do this...
ORDER BY CASE WHEN 'B' THEN 1 WHEN 'A' THEN 2...
April 21, 2008 at 3:57 am
This is a lot easier in SQL 2005 since you can use 'cross apply'. In SQL 2000, I think you will have to loop through your rows using a while...
April 21, 2008 at 3:52 am
Another way...
SELECT * FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'MyTable'
April 21, 2008 at 3:45 am
You could also consider using a computed column directly on the table...
http://www.sqlservercentral.com/articles/User-Defined+functions/complexcomputedcolumns/2397/
April 21, 2008 at 3:42 am
Ah, I see [Val 1] must be a varchar, so perhaps you can make use of one of these...?
ORDER BY LEN([Val 1]) DESC, [Val 1] DESC
or
ORDER BY RIGHT(SPACE(20) + [Val...
April 21, 2008 at 3:32 am
Here are a couple of ways...
declare @x varchar(30)
set @x = '20081011192921703'
select cast(substring(@x, 1, 8) + ' ' + substring(@x, 9, 2) + ':' + substring(@x, 11, 2)
...
April 21, 2008 at 3:25 am
You've lost me. Give a few examples of inputs and required outputs...
April 21, 2008 at 2:50 am
I fear I will not be able to fit everything in the dynamic sql.
What is your basis for this fear?
April 21, 2008 at 1:42 am
Is it assigning the text 'Center' to the variable @Center and etc.
No. That would have to be...
SELECT @Center = 'Center', etc
It's not assigning anything - it's just selecting the value...
April 20, 2008 at 4:34 pm
Kaushik Kumar (4/18/2008)
thanks. This definitely gives me a starting point.also, I feel left out with FLOWR, are there any good online tutorials?
I don't know - sorry...
April 18, 2008 at 9:35 am
Does this help?
declare @x xml
set @x = '
<bo>
<row number="1">
<column1>value</column1>
<column2>value</column2>
<column3>value</column3>
</row>
<row number="2">
<column1>value</column1>
<column4>value</column4>
...
April 18, 2008 at 9:17 am
Viewing 15 posts - 196 through 210 (of 683 total)