1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Oracle TO_CHAR in MS Sql Server 2005.

Discussion in 'Databases' started by kjewat, Jul 18, 2006.

  1. #1
    Hi.

    I have a bunch of SQL queries designed for Oracle. They all use the TO_CHAR function in Oracle. Now I want to run the same SQL queries in Micrsoft Sql Server 2005, without changing the SQL.

    The problem is that the TO_CHAR function does not exist in Sql Server. The way to do it in Sql server would be to use the CONVERT function, but I do not want to change the existing SQL.

    First I thought "Oh..thats easy, just create a function named TO_CHAR that returns CONVERT(..)", but the SQL queries use the TO_CHAR function without the owner name in front (TO_CHAR instead of owner.TO_CHAR). If you do that in Sql server you get an error saying that the system function TO_CHAR does not exist. One need to specify the owner name when calling user defined function in Sql server.

    Any ideas how I can use the existing SQL queries without editing them?
     
    kjewat, Jul 18, 2006 IP