|
 |
access_asp thread: Converting from Varchar to Integer in access database
Message #1 by "Peter Samuelsson" <psadi@b...> on Wed, 29 Aug 2001 19:22:34 +0200
|
|
I have normolized a access database and are now in the process of writing an
ASP page that will move all my data from the old database to the new access
database. The problem I have is that I have to convert some columns from
varchar to integer. Im new to ASP so I need help.
To move the data in tables I dont need to convert colums I do like this
<%
Set Conn=Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" &
Server.MapPath("users1.mdb")
SQL = "INSERT INTO Site (SiteName, Game, CreationDate) IN
'f:\sol\www\beta.mdb' SELECT SiteName, Game, CreationDate FROM Sites"
Conn.Execute(SQL)
Response.Write "Done"
Conn.Close
Set Conn = Nothing
%>
Since SQL has a CONVERT function (or at least SQL Server has it) I was
thinking if I could use that but I dont get it to work.
SQL6="SELECT CONVERT (Varchar, CountryNumber) AS Integer FROM Account"
I also need to be able to put the 'f:\sol\www\beta.mdb' on a server. The
same server as I have in the Conn. Is that possible??
Thanks Peter Samuelsson
Message #2 by "Zee Computer Consulting" <zee@t...> on Wed, 29 Aug 2001 17:20:00 -0700
|
|
With the Jet Driver and an Access database, only Jet-supported functions can
be used. Try using this instead:
SELECT cInt( VarChar ) AS NumVarChar FROM Account
-- Z
----- Original Message -----
From: Peter Samuelsson <psadi@b...>
> The problem I have is that I have to convert some columns from
> varchar to integer. Im new to ASP so I need help.
>
> Since SQL has a CONVERT function (or at least SQL Server has it)
> I was thinking if I could use that but I dont get it to work.
>
> SQL6="SELECT CONVERT (Varchar, CountryNumber)
> AS Integer FROM Account"
|
|
 |