MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsDatabasesMS SQL Development

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 28th, 2003, 03:26 PM
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: 10
change 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("\db\jobdatabase.mdb") & ";" & _
              "Persist Security Info=False"
Conn.Open(sConnection)
%>

<%
if (Request.form("search") = "" )  or (Request.form("search") = " " ) then
  SQL1 = "SELECT * FROM jobs" 
  set Rs = Conn.Execute(SQL1)
Else

  strSplit = split(Request.form ("search"),",") ' value to search for in title
  Dim iNext
  For i = 0 To UBound(strSplit)
    if (strSplit(i) <> "") and (strSplit(i) <> " ") Then
      if (i=0) then
        Booltxt="WHERE ( "
      Else
        Booltxt="OR "
      End If
      sql_search1 = sql_search1 & Booltxt & " description like '%" & strSplit(i) & "%'   " 
     End If
  Next 'i
  sql_search1 = sql_search1 & ")"

  SQL = "SELECT * FROM jobs  " & sql_search1  
  set Rs = Conn.Execute(SQL)
End If
%>


Thanks in advance.

Reply With Quote
  #2  
Old October 31st, 2003, 04:50 PM
Scorpions4ever's Avatar
Scorpions4ever Scorpions4ever is offline
Banned ;)
Dev Shed God 9th Plane (9000 - 9499 posts)
 
Join Date: Nov 2001
Location: Woodland Hills, Los Angeles County, California, USA
Posts: 9,387 Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level)Scorpions4ever User rank is General 46th Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 1 Day 21 h 39 m 3 sec
Reputation Power: 4080
The above SQL statement will work unmodified on MSSQL. You'll need to change the sConnection string though, to connect to MSSQL instead of Access.
__________________
Up the Irons
What Would Jimi Do? Smash amps. Burn guitar. Take the groupies home.
"Death Before Dishonour, my Friends!!" - Bruce D ickinson, Iron Maiden Aug 20, 2005 @ OzzFest
Down with Sharon Osbourne

Reply With Quote
  #3  
Old October 31st, 2003, 11:51 PM
Doug G Doug G is offline
Grumpier Old Moderator
Dev Shed God 19th Plane (14000 - 14499 posts)
 
Join Date: Jun 2003
Posts: 14,238 Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level)Doug G User rank is General 52nd Grade (Above 100000 Reputation Level) 
Time spent in forums: 1 Month 4 Weeks 15 h 7 m 57 sec
Reputation Power: 4445
There are other differences you'll have to accomodate in your code. For example, in Access the delimiter for date fields is #, but in sql server it's '

There is no boolean datatype in sql server

There is a page on the MS website that describes the differences between the two databases.

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > change from Access to MS SQL

Developer Shed Advertisers and Affiliates



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 | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap