Oracle FAQ | Your Portal to the Oracle Knowledge Grid |
Home -> Community -> Usenet -> c.d.o.tools -> Re: Oracle / MS SQLServer - string concatenation & other migration issues
Daniel A. Morgan <Daniel.Morgan_at_attws.com> wrote:
>
> Douglas Reay <douglasr_at_chiark.greenend.org.uk> wrote:
>>
>> For example:
>>
>> In Oracle, if I want to concatenate two strings, I can do either:
>> SELECT 'foo' || 'bar'
>> or
>> SELECT CONCAT( 'foo', 'bar' )
>> while in SQLServer one uses:
>> SELECT 'foo' + 'bar'
>>
>> Now, using SQLServer's UDFs I can do:
>> CREATE FUNCTION concat ( @one varchar(1024), @two varchar(1024) )
>> RETURNS varchar(2048) AS
>> BEGIN
>> RETURN @one + @two
>> END
>>
>> But unfortunatly, that still leaves me having to call it as:
>> SELECT douglas.CONCAT( 'foo', 'bar' )
>>
>> Is there any way around this, or am I stuck with forking the java?
>
> Every attempt I have ever seen to do this has ended in either failure or
> with bad code unless the coding was done in the back-end as procedures.
Is there a way in MS SQL Server to use stored procedures or user defined functions such that the following fragment of SQL will work:
SELECT CONCAT( 'foo', 'bar' )
?
Douglas
-- Douglas Reay Matrix House, Cowley Park, Cambridge, CB4 0HH, UK The Mathworks Ltd. http://www.mathworks.co.uk/consulting/ Engineering Consultant (PUME) <dreay_at_uk.mathworks.com> Powertrain Unified Modeling Environment +44 1223 423200 x 215Received on Mon Jul 23 2001 - 04:19:17 CDT