Trying to capture some sql server/sybase related research (minimal). I need to tell the underlying RDBMS type the current statement is running on and run a raiserror dependant on it (as the method signature is heterogenous). Intra-procedure to support portable code. However, @@servername is the closest I’ve got so far, which is crap, and the syntax check fails on both anyway cos of the method signatures. Nuts and bolts. I think I’m going to have to construct the SQL in calling process which knows what type of rdbms it’s using. Ah well.
DECLARE @errorString varchar(50), @errorValue int
SET @errorString = 'processing date hack'
SET @errorValue = @@error
IF LEFT(@@SERVERNAME, 3) = 'SYB'
RAISERROR 17000 'Failed while processing %1! with error no %2!.', @errorString, @errorValue
RAISERROR ('Failed while processing %s with error no %d.',
16, 1, @errorString, @errorValue)