Forum Replies Created

Viewing 15 posts - 7,006 through 7,020 (of 10,144 total)

  • RE: Error in dynamic SQL statement

    a_ud (11/23/2010)


    Hi guys,

    Thanks to all, but I'm still struggling to see what the problem is (and that would really help). Structures like this:

    set @sql=<whatever>

    exec(@sql)

    usually work in dynamic SQL (I learnt...

  • RE: Error in dynamic SQL statement

    Watch the scope of your @Events table variable:

    DECLARE @Events TABLE ([Name] varchar(120))

    DECLARE @Id INT, @sql VARCHAR(2000)

    SET @Id = 3

    SET @sql = 'SELECT TOP 10 [Name] ' + 'FROM dbo.syscolumns '...

  • RE: Adding data randomly into a column of a table

    For ages up to 100, try

    SELECT RandomAge = 1 + abs(checksum(newid()))%100

  • RE: order result selected by LIKE

    wagner-670519 (11/23/2010)


    no, this counts the rows...

    I need the information about the biggest hit rate.

    When I search for 99911 both rows matches, 999 and 99911. But the hit rate of 99911...

  • RE: cursor appropriate?

    MonsterRocks (11/23/2010)


    but i have 20 columns in table1...Should i add 20 columns in table2 too?

    Surely just the keys (primary keys) would be sufficient?

  • RE: cursor appropriate?

    if object_id('tempdb..#table1') IS NOT NULL DROP TABLE #table1;

    if object_id('tempdb..#table2') IS NOT NULL DROP TABLE #table2;

    if object_id('tempdb..#table3') IS NOT NULL DROP TABLE #table3;

    create table #table1 (col1 int,col2 varchar(30), col3 varchar(30));

    insert into...

  • RE: cursor appropriate?

    MonsterRocks (11/23/2010)


    any idea ?... cursor inevitable?....

    Don't think so. Try this, it's the same as yours with the little errors removed, mostly column types:

    if object_id('tempdb..#table1') IS NOT NULL DROP TABLE #table1;

    if...

  • RE: Are the posted questions getting worse?

    All of us began our SQL Server lives knowing nothing at all about it and we didn't learn what we now know overnight 😉

  • RE: Today's Random Word!

    CirquedeSQLeil (11/22/2010)


    crookj (11/22/2010)


    WOTD - turducken

    Joe

    Have a duchikey myself.

    This looks mouthwateringly good but has an eyewatering price.

  • RE: Today's Random Word!

    Ventilation

  • RE: Today's Random Word!

    crookj (11/22/2010)


    WOTD - turducken

    Joe

    Is this what they're calling the "Russian doll" roast?

  • RE: Are the posted questions getting worse?

    CirquedeSQLeil (11/22/2010)


    Chris Morris-439714 (11/22/2010)


    Wishing Jack C a speedy recovery and some quality time for recuperation.

    Get well soon, mate.

    Did I miss something more than the burnout?

    Our DBA caught some news on...

  • RE: Are the posted questions getting worse?

    Wishing Jack C a speedy recovery and some quality time for recuperation.

    Get well soon, mate.

  • RE: cursor appropriate?

    MonsterRocks (11/22/2010)


    create table #table1 (col1 int,col2 varchar(30))

    insert into #table1 values (1,'martin')

    insert into #table1 values (2,'tom')

    insert into #table1 values (3,'schrof')

    create table #table2(t_col1 int identity(1,1),t_col2 int)

    create table #table3 (f_col1 int identity(1,1),f_col2 varchar(30),f_col3...

  • RE: cursor appropriate?

    MonsterRocks (11/22/2010)


    is cursor needed for following scenario?

    create table #table1 (col1 int,col2 varchar(30))

    insert into #table1 values (1,'martin')

    insert into #table1 values (2,'tom')

    insert into #table1 values (3,'schrof')

    create table #table2(t_col1 int identity(1,1),t_col2 int)

    create table...

Viewing 15 posts - 7,006 through 7,020 (of 10,144 total)