SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2008 Forums
 Transact-SQL (2008)
 format not recognized
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

slimjen
Yak Posting Veteran

61 Posts

Posted - 07/16/2012 :  13:54:13  Show Profile  Reply with Quote
Hi all,
I converted a query to pass thru and got this error:

odbc sql server driver[sql server] 'format' is not a recognized built in function

Here is the query:
SELECT dbo_tblDTFInvoice_test.txtINVOICENUM AS INVOICENUM,
 dbo_tblDTFInvoice_test.txtCARRIERID AS CARRIERID,
 dbo_tblDTFInvoice_test.txtCARRIERNAME AS CARRIERNAME,
 dbo_tblDTFInvoice_test.txtCARRIERACCTNUM AS CARRIERACCTNUM,
 Format([dteDATAENTDTE], "mm-dd-yyyy") AS DATAENTRYDATE,
 Format([dteINVOICEDTE], "mm-dd-yyyy") AS INVOICEDATE,
 Format([dteMONTHPAID], "mm-dd-yyyy") AS MONTHPAID,
 dbo_tblDTFInvoice_test.memCOMMENT AS COMMENT,
 dbo_tblDTFShipInfo_test.txtAWBNUM AS AWBNUM,
 Format([dteIMP/EXPENTDTE], "mm-dd-yyyy") AS SHIPDATE,
 Format([dteIMP/EXPENTDTE], "mmmm yyyy") AS MONTHPROCESSED,
 dbo_tblDTFShipInfo_test.txtSHIPTYPE AS SHIPTYPE,
 dbo_tblDTFShipInfo_test.numTOTALCHGS AS TOTALCHGS,
  dbo_tblDTFShipInfo_test.txtDESTNZIP AS RECIPIENTZIP,
 dbo_tblDTFShipInfo_test.numWEIGHT AS WEIGHT,
 [numTOTALCHGS]/[numWEIGHT] AS CostPerPound,
 dbo_tblDTFShipInfo_test.txtSERVICETYPE AS SERVICETYPE,
 dbo_tblDTFShipInfo_test.txtCOSTCENTER AS COSTCENTER,
FROM dbo_tblDTFInvoice_test 
INNER JOIN dbo_tblDTFShipInfo_test ON dbo_tblDTFInvoice_test.txtINVOICENUM = dbo_tblDTFShipInfo_test.txtINVOICENUM
ORDER BY dbo_tblDTFInvoice_test.txtINVOICENUM;

Can anyone help me?
Thanks

edit: reformatted to avoid long lines

nigelrivett
Flowing Fount of Yak Knowledge

United Kingdom
3328 Posts

Posted - 07/16/2012 :  13:57:15  Show Profile  Visit nigelrivett's Homepage  Reply with Quote
What it says - format isn't an sql server function.
change
Format([dteIMP/EXPENTDTE],"mm-dd-yyyy")
to
convert(varchar(10),[dteIMP/EXPENTDTE],110)


==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page

slimjen
Yak Posting Veteran

61 Posts

Posted - 07/16/2012 :  14:36:23  Show Profile  Reply with Quote
It worked for all except converting to mmmm yyyy? What is the code for this? not 110 or 113.
Thanks so much.
Go to Top of Page

robvolk
Most Valuable Yak

USA
15559 Posts

Posted - 07/16/2012 :  14:49:59  Show Profile  Visit robvolk's Homepage  Reply with Quote
SELECT DATENAME(month,[dteIMP/EXPENTDTE]) + ' ' + DATENAME(year,[dteIMP/EXPENTDTE])
Go to Top of Page

slimjen
Yak Posting Veteran

61 Posts

Posted - 07/16/2012 :  16:35:05  Show Profile  Reply with Quote
It worked! Thanks so much!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.09 seconds. Powered By: Snitz Forums 2000