cancel
Showing results for 
Search instead for 
Did you mean: 
Read only

Multirow inserts

Former Member
14,460

Sybase has the ability to make an insertion multi rows? If yes, what version is available? If not, has plans to develop?

View Entire Topic
Former Member

The multiple values option in 12.0.0 is great; but if you have an old version or want to do some SQL substitutions related to a fixed set of data in your Stored Procedure, try using OpenXML. I do the following when building up a set of error messages that I want to hardcode (for maintenance reasons) into the code and that have to be translated using tables in system:

create table #E (idSituationCUR unsigned integer, txMessage char(150), idSeqRead integer default 0);

-- using openxml to simplify the load and set a default value should the Join with CodelistTranslation
-- fail to find a corresponding entry
insert into #E (idSituationCUR, txMessage)
select LOAD.idSituationCUR, isnull(CLT.txOther,LOAD.txOther)
from OPENXML( string ('<a>',
  '<b c1="6201" c2="REF"                                    c3="',@kSituation_APPENDED,'"/>',
  '<b c1="6202" c2="CODE USED BY 2+ ITEMS, FIX ONLINE ONLY" c3="',@kSituation_MULTICDs,'"/>',
  '<b c1="6203" c2="UNKNOWN/CAN ADD"                        c3="',@kSituation_NOTFOUND,'"/>',
  '</a>'),
  'a/b' )
with ( idKey integer '@c1', txOther text '@c2', idSituationCUR unsigned integer '@c3') AS LOAD
left outer join BOS.CodelistLanguage CLT 
  on CLT.idCodelist = 238 and CLT.idLanguage = @idLanguage and CLT.idKey = LOAD.idKey;