Cursors

  • delete from FALLOUTSDASHBOARD.dbo.IVAPP_ACCEPTANCE_FLOWTHRU_BY_SVCTYPE_SUMMARYinsert into FALLOUTSDASHBOARD.dbo.IVAPP_ACCEPTANCE_FLOWTHRU_BY_SVCTYPE_SUMMARY SELECT distinct top 100* FROM [112.64.104.210,3824].FALLOUTSDASHBOARD.dbo.IVAPP_ACCEPTANCE_FLOWTHRU_BY_SVCTYPE_SUMMARY

    Msg 156, Level 15, State 1, Line 1

    Incorrect syntax near the keyword 'into'.

    i wote a cursor , but getting this error please help me

  • For one thing, it looks like you're missing spaces in a few spots. That's quite possibly the error.

    How about laying out the code so it can be read?

    - Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
    Property of The Thread

    "Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon

  • Once you layout the code in a readable format, I think the error and resolution will become obvious to you.

    As Gus said, you are missing some spaces. Remember that White Space in TSQL is your friend.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

  • fetch next from c1 into @db_name,@table_name,@date,@col

    WHILE (@@FETCH_STATUS = 0)

    begin

    set @sql = 'delete from ' +@db_name +'.dbo.'+@table_name+'insert into '+@db_name+'.dbo.'+@table_name+' SELECT distinct top 100* FROM [112.64.104.210,3824].'+@db_name+'.dbo.'+@table_name --+ 'WITH (nolock)'-- WHERE '+@col+@states_contd+@date_dt =

    here is the code . plzz help me

  • fetch next from c1 into @db_name,@table_name,@date,@col

    WHILE (@@FETCH_STATUS = 0)

    begin

    set @sql = 'delete from ' +@db_name +'.dbo.'+@table_name+'insert into '+@db_name+'.dbo.'+@table_name+' SELECT distinct top 100* FROM [112.64.104.210,3824].'+@db_name+'.dbo.'+@table_name --+ 'WITH (nolock)'-- WHERE '+@col+@states_contd+@date_dt =

    ---Make sure you leave a space after every variable in building dynamic sql (@sql).

    I guess you are missing a space after the variable @table_name..

    Please check..

    If that doesnt work...

    After you build the dynamic sql ..instead of executing, put a PRINT statement..Print @sql..

    when you execute the procedure in SSMS it will render the query in results window. copy that and paste in SSMS and check for syntax errors...

    -----------------------------------------------------------------------
    For better assistance in answering your questions[/url]
    Perforamance Issues[/url]
    Cross Tabs and Pivots[/url]
    Cross Apply[/url]
    The Numbers or Tally Table- Jeff Moden[/url]

  • Yes it worked , thanks a lot , i needed to put spaces after delete from and before insert into.

    now i need i need to put a data range , for to insert date .

    like in this format -

    if i need to insert date only for a specific range

    12/06/2009 - 12/08/2009

    what i have to do

    plz help ,As i am new to this stuff.

  • NewBeeSQL has hit it on the head.

    Jason...AKA CirqueDeSQLeil
    _______________________________________________
    I have given a name to my pain...MCM SQL Server, MVP
    SQL RNNR
    Posting Performance Based Questions - Gail Shaw[/url]
    Learn Extended Events

Viewing 7 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic. Login to reply