Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


CAST (expression AS data-type)... Need an alternative function for the same in MS-SQL Server.

Posted on 1999-07-08
Medium Priority
Last Modified: 2012-06-21
Returns the value of expression, converted to the supplied data-type.
Cast function supports the conversion to User Defined Data Type (UDT).
UDT - C_Date (Base data type - Char(12))

Cast (GetDate() as C_Date) : This will convert the current date in char(12) format.

MS-SQL Server 6.5
Convert function can not be used.
As User Defined data type cannot be used.
Gives the error - '<> is not a defined system type.'
Need an alternative function for the same in MS-SQL Server.
Question by:siddhartharathi
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions

Accepted Solution

simonsabin earned 80 total points
ID: 1096258
This not possible in SQl server. I know it is not the answer you want but unfortunately that is the answer

Expert Comment

by:Gustavo Perez Buenrostro
ID: 1096259
CONVERT and CAST functions only work using SQL Server-supplied data types (User-defined data types cannot be used)
However, you can do something special to resolve your problem.
Let me know if you are interested in.


Expert Comment

ID: 6873152

This question was awarded, but never cleared due to the JSP-500 errors of that time.  It was "stuck" against userID -1 versus the intended expert whom you awarded.  This corrects the problem and the expert will now receive these points; points verified.

Please click on your Member Profile and select "View Question History" to navigate through any open or locked questions you may have to update and finalize them.  If you are an EE Pro user, you can also choose Power Search to find all your open questions.

This is the Community Support link, if help is needed, along with the link to All Topics which reflects many TAs recently added.
Thank you,
Moderator @ Experts Exchange

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Ever wondered why sometimes your SQL Server is slow or unresponsive with connections spiking up but by the time you go in, all is well? The following article will show you how to install and configure a SQL job that will send you email alerts includ…
This article shows gives you an overview on SQL Server 2016 row level security. You will also get to know the usages of row-level-security and how it works
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.

670 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question