To register for an Internet.com membership to receive newsletters and white papers, use the Register button ABOVE.
To participate in the message forums BELOW, click here

HOME News MS SQL Oracle DB2 Access MySQL PHP Scripts Books Links DBA Talk


Go Back   Database Journal Forums > Related Sites > SQL Course

SQL Course SQL Course > Ask questions about the lessons on SQL Course 1 and 2. If you have problems > with the interface, please post in the Feedback forum

Reply Post New Thread
 
Thread Tools Search this Thread Rate Thread Display Modes
  #1  
Old 03-01-2003, 02:54 AM
kaur_gurpreet kaur_gurpreet is offline
Junior Member
 
Join Date: Mar 2003
Posts: 16
Boolean Type From Access In Sql

I want to convert my existing access database to sqlserver.
The Boolean Datatype in Sqlserver is converted to bit but my queries in VB stop working

if in VB I Say

Select * From Table WHERE BoolField=true

It Doesn't work???

what is the easy way to convery it to make it sql compatible
Reply With Quote
  #2  
Old 03-02-2003, 04:39 AM
PinkPanther2003 PinkPanther2003 is offline
Senior Member
 
Join Date: Feb 2003
Posts: 102
BIT DATA TYPE

SQL SERVER (at least 7.0 and 2000)
--true condition
WHERE <your boolean field> = 1

--false condition
WHERE <your boolean field> = 0

True is -1 in JET - type cint(True) into the debug window.

As a general rule,

Please specify what versions of the software you are using.

Give some more details about how you are connecting to the SQL Server in VB.

Give some more details about what the error message was etc not just "It doesn't work".

HTH,

Peter
Reply With Quote
  #3  
Old 03-03-2003, 04:23 AM
kaur_gurpreet kaur_gurpreet is offline
Junior Member
 
Join Date: Mar 2003
Posts: 16
I'm Using Sql Server 7.0
My Existing Project is VB6.0+MsAccess
I want To switch Over To SQL SERVER

Boolean Data Type in Ms Access is Converted to bit datatype in SQL SERVER

My Code in VB EveryWhere Has SqlStatements like

SELECT * FROM TABLE WHERE BOOLFielD=True

If I Run the Same in Query Analyzer It Gives the following Error

[Invalid column name 'true'.]

The Bit DataType Accepts 0 and 1
i need an easy way to convert my existing project so that i don't have to make a lot of changes
Reply With Quote
  #4  
Old 03-03-2003, 04:31 AM
PinkPanther2003 PinkPanther2003 is offline
Senior Member
 
Join Date: Feb 2003
Posts: 102
REPLACE?

kaur,

Cheers for the information. Do a search on www.google.com for a product called Speed Ferret. It is a great tool for replacing strings in your Access db's. If the TRUE's are only in your queries you could do something like

dim qd as dao.querydef
dim strSQL as string

for each qd in currentdb.querydefs
strSQL = qd.sql

next

set qd = nothing
Reply With Quote
  #5  
Old 03-03-2003, 04:44 AM
PinkPanther2003 PinkPanther2003 is offline
Senior Member
 
Join Date: Feb 2003
Posts: 102
REPLACE?

Kaur,

I could offer some suggestions for MS Access but not VB apart from use find and replace but I am sure you've already considered this one.

Peter
Reply With Quote
  #6  
Old 03-04-2003, 02:11 AM
kaur_gurpreet kaur_gurpreet is offline
Junior Member
 
Join Date: Mar 2003
Posts: 16
Replace is not the solution as i do not want to replace all true/ false
only the ones in queries

and i have a big project so i cann't check each and everyone and replace

i couldn't understand what you mean by
dim qd as dao.querydef
dim strSQL as string

for each qd in currentdb.querydefs
strSQL = qd.sql

next
Reply With Quote
Reply Post New Thread

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT -5. The time now is 02:56 AM.


DatabaseJournal Recent Articles


 » Preparing To Upgrade Access Tables to SQL ...

 » Microsoft Windows PowerShell and SQL Serve...

 » New MySQL Enterprise with Query Analyzer B...

 » Quest Software Strengthens Committment to ...

 » Oracle Unveils New Event-Driven Middleware...

Search Database Journal:
 





Acceptable Use Policy

JupiterOnlineMedia

internet.comearthweb.comDevx.commediabistro.comGraphics.com

Search:

Jupitermedia Corporation has two divisions: Jupiterimages and JupiterOnlineMedia

Jupitermedia Corporate Info


Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Web Hosting | Newsletters | Tech Jobs | Shopping | E-mail Offers

Powered by vBulletin® Version 3.7.4
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.