Sybase to SqlServer syntax question

  • The raiseerror syntax is different between the two languages, but I am having trouble figuring out how to convert a statement with arguments. Not having used Sybase before, I am not certain how this information is being sent and the help documentation does not sufficiently explain the arglist feature.

    Sybase Syntax

    raiserror 20026, '(From) Organization Chart', @old_OrgUnitChart_ID, 'SF', 'Organization Unit Chart', @old_OrgUnitChart_ID, 'Organization Unit Chart',@An_OrgUnitChart_ID

    I would really appreciate some help on this. How are the parameters used? How do I convert this to SqlServer 2000 syntax?  Thank you!

    Artie

  • You lost me on this posting.  Do you want to go from SQL Server to Sybase or from Sybase to SQL Server? 

    Could you post the entire code?  [both the SQL Server and Sybase] 

     

    I wasn't born stupid - I had to study.

  • Sybase to sql server .

    Raiserror ('message here', SeverityLevel, ??)

    look it up in the books online for the exact details.

  • From Sybase to SqlServer.  The attached line of code was the entire raiseError line in Sybase. 

    The Sybase version of RAISERROR allows argument substitution in any order, but the arguments must be of data type varchar or char. The SQL Server RAISERROR statement requires positional argument substitution, like printf in the C language, but supports integer and string substitution: %d, %i, %s. This RAISERROR statement also supports the specification of a severity level (range 1 through 25).

    So:

    Example: Change Sybase Statement --“raiserror 40204 'A County Code already exists : %1!.', @Ccode” to SqlServer syntax “raiserror ('A County Code already exist with code: %1!.', 16, 1, @Ccode)”.

    This makes sense.  But the structure of the following attached Sybase raiseError statement confused me..I cannot figure out what the correct SqlServer syntax will be.

    Sybase Syntax

    raiserror 20026, '(From) Organization Chart', @old_OrgUnitChart_ID, 'SF', 'Organization Unit Chart', @old_OrgUnitChart_ID, 'Organization Unit Chart',@An_OrgUnitChart_ID

  • This is the most usefull english help I can find :

    http://msdn.microsoft.com/library/?url=/library/en-us/acdata/ac_8_con_05_3f76.asp

  • Thanks for the responses.  Unfortunately, I have already seen those links .. I already know the basic SqlServer syntax for raiseerror (as I described in my second email).  I specifically cannot understand the following Sybase raiserror construct...

    Sybase Syntax

    raiserror 20026, '(From) Organization Chart', @old_OrgUnitChart_ID, 'SF', 'Organization Unit Chart', @old_OrgUnitChart_ID, 'Organization Unit Chart',@An_OrgUnitChart_ID

    Thanks!

    Artie

  • I can only suggest you google : Sybase raiserror

    Good luck.

  • SET [Sybase DBA mode] ON

    go

     

    How about this:

    http://manuals.sybase.com/onlinebooks/group-as/asg1250e/sqlug/@Generic__BookTextView/40544

     

    Here's a good detailed explanation (page 411 in the PDF file:

     

    http://www.nd.edu/~ddenting/reference_manual.pdf

     

    SET [Sybase DBA mode] OFF

    GO

     

    RegardsRudy KomacsarSenior Database Administrator"Ave Caesar! - Morituri te salutamus."

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

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