If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > Sybase > sp_remotesql() throwing "ASA Error -131: Syntax error near '(end of line)' on line 1"

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 02-19-10, 05:18
suhel_2112 suhel_2112 is offline
Registered User
 
Join Date: Sep 2009
Posts: 7
sp_remotesql() throwing "ASA Error -131: Syntax error near '(end of line)' on line 1"

Target Server : IWS_IQ.
Query Executed from : ASE server.

NOTE: when i execute the query in IQ directly. there is no error.

NOTE: S.DW_CALL_START_DT_ID column of the target table is unsigned int not null

begin

declare @d1 char(8)
declare @d2 char(8)
declare @commit1 varchar(8)
declare @insert_str varchar(16000)

select @d1 = convert(char(8), 20090901)
select @d2 = convert(char(8), 20090902)
select @commit1 = "commit"

select @insert_str = 'insert into prd.SCOV2_U_REV (' + 'DW_ORIG_SERV_ID , MONTH_END_DT, SOURCE_SYS,' +
'DW_PRICEBL_ID ,TYPE_TRAFF, TOTAL_TIER_CHARGE,ACTUAL_UNITS )' +
' select S.DW_ORIG_SERV_ID, S.DW_CALL_START_DT_ID , S.SOURCE_SYS,' +
'0 as DW_PRICEBL_ID, ''V'' as TYPE_TRAFF, ' +
' sum( NUM_OF_CALLS) as TOTAL_TIER_CHARGE, 0 as ACTUAL_UNITS ' +
' from prd.S_DAY_BY_DEST as S where ' +
' S.DW_CALL_START_DT_ID >= ' + @d1 + ' and ' +
' S.DW_CALL_START_DT_ID < ' + @d2 + ' ' +
' group by S.DW_ORIG_SERV_ID, S.DW_CALL_START_DT_ID, ' +
' S.SOURCE_SYS, S.DW_PRICEBL_ID, S.ACTUAL_UNITS '

print "%1!", @insert_str

exec sp_remotesql 'IWS_IQ', @insert_str

end
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On