Database Management
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesDatabase Management

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old October 29th, 2003, 06:05 AM
gintom gintom is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Sep 2003
Location: Essex, UK
Posts: 164 gintom User rank is Private First Class (20 - 50 Reputation Level)gintom User rank is Private First Class (20 - 50 Reputation Level) 
Time spent in forums: 17 h 16 m 46 sec
Reputation Power: 6
changing from access to MS SQL

At the moment I have an MS Access database and is getting full very quickly.

I want to upgrade to a MS SQL database provided by my hosting provider. My current site is written in ASP and SQL, I want to know would I have to allter any SQL or ASP coding to make it compatible with the MS SQL database instead of access.

This is an example of the coding that I am using at the moment to perform searches.

Code:
<%

' Open the Database Connection
SET Conn = Server.CreateObject("ADODB.Connection")
sConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
              "Data Source=" & Server.MapPath("\********.mdb") & ";" & _
              "Persist Security Info=False"
Conn.Open(sConnection)
%>

I know that I will need to change the connection to the database but that is all that I know what has to be changed.

Below is just a SQL sample that is used on my site. (I am using sessions below because the 2 pages before are secure credit card pages, so I have to write them to a session variables before going through the 3rd party servers).
Code:
<%sqlString1 = "INSERT INTO jobs " &_
  "( accountNo,jobtitle,category,jobtype,salary,benefits,location,jobdescription,companyname,companytype,  contact,email,phone,reference,method,VendorTxCode )" &_
  "VALUES( " &_
  "'" & Session("accountNo") & "'," & _
  "'" & Session("jobtitle") & "'," & _
  "'" & Session("category") & "'," & _
  "'" & Session("jobtype") & "'," & _
  "'" & Session("salary") & "'," & _
  "'" & Session("benefits") & "'," & _
  "'" & Session("location") & "'," & _
  "'" & Session("jobdescription") & "'," & _
  "'" & Session("companyname") & "'," & _
  "'" & Session("companytype") & "'," & _
  "'" & Session("contact") & "'," & _
  "'" & Session("email") & "'," & _
  "'" & Session("phone") & "'," & _
  "'" & Session("reference") & "'," & _
  "'" & Session("method") & "'," & _   
  "'" & VendorTxCode & "')" 
           
  Conn.Execute(sqlString1)
%>


Thanks in advance.

Reply With Quote
  #2  
Old October 29th, 2003, 12:35 PM
r937's Avatar
r937 r937 is offline
SQL Consultant
Click here for more information.
 
Join Date: Feb 2003
Location: Toronto Canada
Posts: 17,978 r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level)r937 User rank is General 1st Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 18 h 3 m 38 sec
Reputation Power: 1028
there are plenty of sites out there that will describe the conversion procedure, and in fact i think you can even get a utility from microsoft to help convert the sql

there are a number of things that you will have to check for in your sql

IIF is replaced by CASE

FORMAT has no straight equivalent, use CONVERT to format dates

DATEADD, DATEDIFF, etc, have slightly different formats

dates are delimited by singlequotes, not octothorps, i.e. #2003-10-29# becomes '2003-10-29'

multi-table joins no longer need parentheses, but be careful of these, some may need to be re-written

saved queries, used in the FROM clause, can be rewritten as VIEWs, or better yet, derived tables


other than that, and i'm sure a few other tidbits i've forgotten, it's a fairly easy conversion




rudy
http://r937.com/

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesDatabase Management > changing from access to MS SQL


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT