Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Monday, November 16, 2015 11:23 PM
Hi Team,
I need a quick help in SQL Server.
Currently In my Existing data stage job we are using a sql query which retrieves the data from MSSQL. In that query It has TO_CHAR function and team mate saying its working. Is there such type of function in MSSQL. If exist what version it has and what driver it support. Can any one let me know.
Your help is highly appreciated..
Vinu
Monday, November 16, 2015 11:39 PM ✅Answered
Hi Team,
I need a quick help in SQL Server.
Currently In my Existing data stage job we are using a sql query which retrieves the data from MSSQL. In that query It has TO_CHAR function and team mate saying its working. Is there such type of function in MSSQL. If exist what version it has and what driver it support. Can any one let me know.
Your help is highly appreciated..
Vinu
oracle and db2 format function to_char
equavalent in sql server is convert
Tuesday, November 17, 2015 1:31 AM ✅Answered
Hi Vinuthana,
To_Char does not exists in SQL server, for the same purpose you can use Cast or Convert, please check the Data Stage package whether you are converting inside the package because To_Char can not work on SQL Server if you are using query. You need to use either Cast or Convert.
Cheers,
Amit Tomar
Please mark this as answer if it solved your query
Please vote this as helpful if it solved your query
Tuesday, November 17, 2015 2:46 AM ✅Answered
Hi Vinuthna,
According to your description, please also refer to FORMAT which applies to SQL Server 2012 through current version.
Sam Zha
TechNet Community Support
Monday, November 16, 2015 11:44 PM
Yes.. It is converting date to char. But are you sure is that really To_Char from SQL 2000..
Tuesday, November 17, 2015 3:39 AM
The ANSI/ISO Standard is CAST (<expression> AS <data type>). The TO-CHAR() is Oracle dialect; CONVERT () is Sybase dialect. Do not use the last two.
--CELKO-- Books in Celko Series for Morgan-Kaufmann Publishing: Analytics and OLAP in SQL / Data and Databases: Concepts in Practice Data / Measurements and Standards in SQL SQL for Smarties / SQL Programming Style / SQL Puzzles and Answers / Thinking in Sets / Trees and Hierarchies in SQL