Forum Replies Created

Viewing 15 posts - 196 through 210 (of 683 total)

  • RE: Query Help - 3

    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...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Query with a Custom Order

    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...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Query with a Custom Order

    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...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Query Help - 3

    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...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: How to check the table columns thru T-sql command

    Another way...

    SELECT * FROM INFORMATION_SCHEMA.COLUMNS where TABLE_NAME = 'MyTable'

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: A View Or a Stored Procedure?

    You could also consider using a computed column directly on the table...

    http://www.sqlservercentral.com/articles/User-Defined+functions/complexcomputedcolumns/2397/

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Concatinate SP always return NULL?

    @sql starts off as null, and you keep appending to it - which will always give null. You need to set @sql...

    DECLARE @Count int

    DECLARE @sql NVARCHAR(2000)

    SET @sql = '' --...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Query with a Custom Order

    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...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Query with a Custom Order

    ORDER BY [Val 1] DESC

    ?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Finding Date & time from a string

    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)

    ...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Query Help - 3

    You've lost me. Give a few examples of inputs and required outputs...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deserialize data in xml column to a table

    I fear I will not be able to fit everything in the dynamic sql.

    What is your basis for this fear?

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: pretty basic code question

    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...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deserialize data in xml column to a table

    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...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

  • RE: Deserialize data in xml column to a table

    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>

    ...

    Ryan Randall

    Solutions are easy. Understanding the problem, now, that's the hard part.

Viewing 15 posts - 196 through 210 (of 683 total)