Forum Replies Created

Viewing 11 posts - 1 through 11 (of 11 total)

  • RE: How to Convert nx1 dimension table to 1x1 dimension table

    Hi!

    Try this, without cursors.

    Regards,

    Liliana.

    SELECT TOP 100 n = IDENTITY(INT, 1, 1) INTO #Numbers

    FROM

    sysobjects a1

    CROSS JOIN

    sysobjects a2

    CROSS JOIN

    ...

  • RE: FOR UPDATE cannot be specified on a READ ONLY cursor

    Hi,

    I think almost everything can be solved without a cursor, but only for give an answer to your question, try without ORDER BY... that is the reason.

    Regards, an sorry my...

  • RE: Parse Varchar Field

    Jesper,

    Thank you very much for the code, it's great!

    Liliana.

  • RE: Parse Varchar Field

    Hi,

    This is the change to insert data in a new table, but it would be very interesting to have Jesper's suggest, without while or change table #test:

    CREATE TABLE #test...

  • RE: Parse Varchar Field

    Hi,

    Take a copy of your table before:

    CREATE TABLE #test (name varchar(40), iq varchar (100))

    INSERT #test SELECT 'Juan', '1 + 5<br>2 + 2<br>4 + 1<br>3 + 3<br>1 + 1'

    INSERT #test SELECT...

  • RE: Pivoting a table with multiple values

    Hi,

    Try this:

    DECLARE @article char(10)

    DECLARE @maxarticle char(10)

    SELECT  @article = MIN(article) FROM #test

    SELECT  @maxarticle = MAX(article) FROM #test

    DECLARE @society VARCHAR(8000)

    WHILE  @article <= @maxarticle

           BEGIN

           SET @society = ''

           SELECT...

  • RE: GETTING VALUES IN DATASET FROM TWO TABLES DEPENDING ON VALUE

    Hi,

    Try this, so your code is independent from values. I suggest don't repeat ItemID in both tables, but if you do, this query will return Standard value.

    SELECT  O.OrderID,

            O.ItemID,...

  • RE: Invalid column name error

    Hello,

    Try with GO before UPDATE:

    IF(SELECT COUNT(*) FROM INFORMATION_SCHEMA.COLUMNS

     WHERE TABLE_NAME = 'mytable'

     AND COLUMN_NAME = 'mycol'

       ) = 0

    ALTER TABLE mytable ADD mycol int not NULL DEFAULT (0)

    GO

    UPDATE mytable SET mycol = myval

    Liliana.

     

  • RE: Change a X orientd results set to X oriented.

    Hello,

    Is not very difficult with dynamic sql and WHILE. Try:

    -- Your table

    CREATE TABLE TEST_COL

    (Id smallint,

     col1 smallint,

     col2 smallint,

     col3 smallint,

     col4 smallint,

     col5 smallint)

    INSERT TEST_COL

    SELECT 1, 11, 21, 31, 41, 51 UNION

    SELECT 2,...

  • RE: ? Convert a Variable''''s Output To a Text String

    Ok, then:

    set @CMD = 'INSERT INTO DBMON..Records (RunDate, DB, RecCount, TBName) Select GetDate(), ''' + @DB +''', rows, b.name FROM ' + @DB + '..sysindexes a , ' + @DB...

  • RE: ? Convert a Variable''''s Output To a Text String

    Hello,

    Try:

    set @CMD = 'INSERT INTO DBMON..Records (RunDate, DB, RecCount, TBName) Select(GetDate(), ''' + @DB +''', rows, b.name) FROM ' + @DB + '..sysindexes a , ' + @DB +...

Viewing 11 posts - 1 through 11 (of 11 total)