I have MS SQL Server 2012 and are executing the following SQL:
INSERT INTO [table] ([isUpdated]) VALUES (False);
This gives the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'False'.
As I understand this is because there is no boolean type in the database, only bit field so only 0 or 1 is accepted. I've recently migrated to this database from the old outdated MS Access format and it accepted True/False in the SQL code. Here is my connection string:
Driver={SQL Server};Server=localhost;Database=mydatabase;Uid=myuser;Pwd=mypassword;
Is there some way to tell MS SQL Server to automatically treat True/False as 1/0?
I'm running a lot of old code and there is a lot of old SQL code that sends in True/False so if at all possible I would like to avoid having to update hundreds of lines of code manually. Is there something I can add to my connection string or a setting in the Server Management Studio program that I can change?
I have MS SQL Server 2012 and are executing the following SQL:
INSERT INTO [table] ([isUpdated]) VALUES (False);
This gives the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server]Invalid column name 'False'.
As I understand this is because there is no boolean type in the database, only bit field so only 0 or 1 is accepted. I've recently migrated to this database from the old outdated MS Access format and it accepted True/False in the SQL code. Here is my connection string:
Driver={SQL Server};Server=localhost;Database=mydatabase;Uid=myuser;Pwd=mypassword;
Is there some way to tell MS SQL Server to automatically treat True/False as 1/0?
I'm running a lot of old code and there is a lot of old SQL code that sends in True/False so if at all possible I would like to avoid having to update hundreds of lines of code manually. Is there something I can add to my connection string or a setting in the Server Management Studio program that I can change?
0 commentaires:
Enregistrer un commentaire