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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Data format and JOIN

Author  Topic 

157
Starting Member

5 Posts

Posted - 2010-07-15 : 10:28:16
Hi!
Please help me..
How can I JOIN 2 records when they are in different formats, one is in number, the second one is in text and I cannot change this formats but I need to join these records? I was trying to use CInt() or Cstr() in sql but it seems that these comands are only for visual basic...Are there any other comands which can convert format in SQL???
Thank!

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-15 : 10:32:18
instead of CINT() use convert(int,Columnname)
instead of CSTR() use convert(varchar(255),Columnname)

if it is unicode then Nvarchar() instead of varchar()


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

157
Starting Member

5 Posts

Posted - 2010-07-15 : 11:08:44
Hi! Thank you!
I used convert as well as cast function, but the definition is a little bit different than yours.
CAST (expression AS data_type [ (length ) ] )Syntax for CONVERT:
CONVERT (data_type [ (length ) ] ,expression [ ,style ] )
When I used these I got a massage: Undefined function CAST\CONVERT in expression.
Where is a problem???
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-15 : 11:35:11
Where did you try to use cast or convert?
Is it MS SQL Server?



No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

157
Starting Member

5 Posts

Posted - 2010-07-15 : 11:38:52
In SQL View.
I made a Query and I went to SQL view. Is it correct?
Go to Top of Page

webfred
Master Smack Fu Yak Hacker

8781 Posts

Posted - 2010-07-15 : 12:09:22
Sorry I don't know what "SQL View" is...


No, you're never too old to Yak'n'Roll if you're too young to die.
Go to Top of Page

157
Starting Member

5 Posts

Posted - 2010-07-15 : 17:48:17
Well...When you are in Access, you make query from the tables and then in that query you can see it as SQL view or design project or others.
I was trying to put CAST or CONVERT function in SQL code in SQL view. Does it make any sense?
Please, i cannot understand why access doesnt understand CAST nad Convert function.
Go to Top of Page

rohit.manj
Starting Member

11 Posts

Posted - 2010-07-16 : 03:15:02
i think you must try Clang or number

CRhudmude
Go to Top of Page

157
Starting Member

5 Posts

Posted - 2010-07-16 : 05:20:27
It does not work. The problem is that CInt, Cstr are commends for Visual Basic, but I dont know how can I view my Query in Access as Visual basic. I can see only SQL code, and CAST/CONVERT are only for SQL Server so I need function which works for SQL Access not in visual basic. Please I am sure that there need to be a solution!
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-07-16 : 11:23:49
Post your question at ACCESS Forum

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -