Site Sponsored By: SQLDSC - SQL Server Desired State Configuration
Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
I have text 060108 that I want to read 06/01/08. Here is what works.left (oaentdate,2) + '/' + substring (oaentdate,3,2) + '/' + substring (oaendate,5,2)However, I can't place it in the Query Select statement. What am I doing wrong?Lisa Jefferson
My query has several select statements. That is the only place where the variable is listed (oaentdate). The variable is selected from the server as 060108. I just want to add the slashes to format it as a date. Where should I put it?Lisa Jefferson
tkizer
Almighty SQL Goddess
38200 Posts
Posted - 2008-06-16 : 14:01:04
If you are using a variable, then use the variable in your code. What you have posted above is referring to a column, not a variable. If you'd like better help than this, it would be best to tell us what screen you are looking at and also show us your code.Tara KizerMicrosoft MVP for Windows Server System - SQL Serverhttp://weblogs.sqlteam.com/tarad/Subscribe to my blog
l-jeff@excite.com
Starting Member
39 Posts
Posted - 2008-06-16 : 14:08:02
Select OABLDATE, OASHIPDTMM + OASHIPDTDD + OASHIPDTYY as shipdates, OAENTUSER, OAENTDATE FROM tbl_Buffer_OpenOrdersWHERE NOT EXISTS (Select ORDERDATE, SHIPDATE, ORDER_ENTER_BY, Entered_Date_TimeFROM tbl_Data_OrdersWHERE tbl_Buffer_OpenOrders.OABL = tbl_Data_Orders.BOL AND tbl_Buffer_OpenOrders.ODLOTSEQ = tbl_Data_Orders.LINE)I don't know where to put the code to change the text to a date format. Yes, it is a column not a variable. Lisa Jefferson
visakh16
Very Important crosS Applying yaK Herder
52326 Posts
Posted - 2008-06-16 : 14:11:29
Select OABLDATE, OASHIPDTMM + OASHIPDTDD + OASHIPDTYY as shipdates, OAENTUSER, left (oaentdate,2) + '/' + substring (oaentdate,3,2) + '/' + substring (oaendate,5,2) FROM tbl_Buffer_OpenOrdersWHERE NOT EXISTS (Select ORDERDATE, SHIPDATE, ORDER_ENTER_BY, Entered_Date_TimeFROM tbl_Data_OrdersWHERE tbl_Buffer_OpenOrders.OABL = tbl_Data_Orders.BOL AND tbl_Buffer_OpenOrders.ODLOTSEQ = tbl_Data_Orders.LINE)