-
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
-
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
-
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
-
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
-
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
-
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
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|