Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,093 members, 7,814,822 topics. Date: Wednesday, 01 May 2024 at 08:25 PM

Mssql / Php Help - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Mssql / Php Help (1078 Views)

Mysql Vs MSSQL / Problem Connecting Mssql Management Studio To The Server / Asp.net/mssql Versus Php/mysql (2) (3) (4)

(1) (Reply) (Go Down)

Mssql / Php Help by skima(m): 10:58am On Feb 06, 2008
I just converted a desktop application to online based (real big work). the software uses MSSql, so i'd developed the application wit mysql so wat i did was to develop a module that will dump the data from mysql to mssql, the module worked fine. so d only error is the datetime data types in MSSQL since the format is different from that of MYSQL. i wrote a function that will do the conversion (like this from 2008-02-22 to 22/02/2008) so while inserting into the MSSQL i got error dat NULL value not allowed even wen there is a visible data. the date column in MSSQL DOES NOT ACCEPT NULL dats the column is compulsory.

example : INSERT INTO table_name (user_id,uname,date_reg) VALUES ('0','myname','22/02/2008')

that exactly how the generated insertion script works. so it always return NULL value not accepted for the date field.

i do not have wide experience in MSSQL, but i do for MYSQL.

help pls
Re: Mssql / Php Help by ThePhantom(m): 12:04pm On Feb 07, 2008
You said you are moving data from Mysql to MSql, maybe you do have a row without data? Anyway this is how you fix it, go into Enterprise manager in MSSQL right click on the table click design table and select "allow null". Also if you are using the insert statement as you showed above you can include "ISNULL"

example : INSERT INTO table_name (user_id,uname,date_reg) VALUES ('0','myname',ISNULL(Date,'unknown')

If there is a null in the date field it will change it to "unknown"
Re: Mssql / Php Help by skima(m): 12:16pm On Feb 07, 2008
@phantom thanx man i will try it out.

is the Date ISNULL(Date,'unknown') a reserved in the query?
Re: Mssql / Php Help by ThePhantom(m): 1:20pm On Feb 07, 2008
Sorry, I just used that as an example.

replace the date with the name of the field you are appending from

ISNULL([your date field],'unknown')
Re: Mssql / Php Help by skima(m): 2:16pm On Feb 08, 2008
thanx man. i took time to run some queries direct on the mssql den debug straight from there. its now working fine.

thanx.

(1) (Reply)

Is Being A Programmer A Good Career Choice? / Hacker Hostels: Living On The Cheap And Dreaming Of Digital Glory / Please, Advice Me On The Program To Select As A Course Of Study.

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 9
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.