|
-
Mar 4th, 2012, 10:38 AM
#1
Thread Starter
New Member
SQL SERVER - Creating VIEW: displaying error
Friends.
Greetings.
I am creating a view in SQL SERVER MANAGEMENT STUDIO 2008 EXPRESS using the following query which I copied from MS-ACCESS.
-------------------------------------
SELECT id, Cust_ID, id AS Expr1, Cust_Name, Rm, CDate(InDate & [ ] & InTime) AS InDateTime, SrvcID, InDate, InTime, InRcrdDate, InRcrdTime, SizeName,
HalaName, LocName, Qty, OutTime, OutDate, OutIqama, Days, CntNo, ExitTime, Deleted, NoCntNo, NoSize, NoHala, NoQty, OutNoCntNo,
DAMAGES_ID_1, DAMAGES_ID_2, DAMAGES_ID_3, DAMAGES_REMARKS, ISO_CODE, VESSEL_IN, VESSEL_OUT, VOYAGE_IN, VOYAGE_OUT,
SHIPPING_LINE_CODE, ETA_IN, Rem, ETA_OUT
FROM dbo.Daily
-------------------------------------
But unfortunately I am getting an error that "CDATE function in not an Inbuilt function".
Guys my task is to migrate the Access Database(including many tables and views)to SQL SERVER.
I was able to migrate everything, but the ACCESS Views are also migrated as an SQL Table.
So now I am manually creating the VIEWS in SQL.
It will be highly appreciable that if u could suggest me any ideas to migrate all the ACCESS QUERIES to SQL VIEWS.
or else Please help me with an alternate for CDATE() in SQL.
Thank You.
-
Mar 4th, 2012, 03:30 PM
#2
Re: SQL SERVER - Creating VIEW: displaying error
If InDate and InTime are both a datetime field you can just add them ( the Indate + InTime). If both are textfields (varchar,nchar,....) you can do cast (Indate + ' ' + InTime as datetime)
-
Mar 4th, 2012, 06:27 PM
#3
Re: SQL SERVER - Creating VIEW: displaying error
This syntax
CDate(InDate & [ ] & InTime)
has a couple of issues.
First the & is not used in MS SQL to concatenate strings - use plus.
If both InDate and InTime are "varchar" type fields then do this
Code:
Cast(InDate + ' ' + InTime as datetime)
-
Mar 5th, 2012, 01:33 AM
#4
Re: SQL SERVER - Creating VIEW: displaying error
This question has absolutely nothing to do with C#. It is purely a T-SQL question and, as such, belongs in the Database Development forum. I have asked the mods to move it there.
-
Mar 5th, 2012, 02:02 AM
#5
Re: SQL SERVER - Creating VIEW: displaying error
Thank you for the report jmcilhinney, I have moved this thread to the Database Development Forum.
Gary
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|