Mssql / Php Help

A Member? Please Login  
type your username and password to login
Date: July 26, 2008, 08:05 PM
223895 members and 127239 Topics
Latest Member: blazer4sex
Nairaland [Nigerian Forum] Home Help Search Who is currently online? Login Register
Nairaland Forum  |  Technology  |  Programming  |  Mssql / Php Help
Pages: (1) Go Down Send this topic Notify of replies
Author Topic: Mssql / Php Help  (Read 125 views)
skima (m)
Mssql / Php Help
« on: February 06, 2008, 10:58 AM »

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 what 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 that NULL value not allowed even when there is a visible data. the  date column in MSSQL DOES NOT ACCEPT NULL that is 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 please
ThePhantom (m)
Re: Mssql / Php Help
« #1 on: February 07, 2008, 12:04 PM »

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"
skima (m)
Re: Mssql / Php Help
« #2 on: February 07, 2008, 12:16 PM »

@phantom thanx man i will try it out.

is the Date ISNULL(Date,'unknown') a reserved in the query?
ThePhantom (m)
Re: Mssql / Php Help
« #3 on: February 07, 2008, 01:20 PM »

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')
skima (m)
Re: Mssql / Php Help
« #4 on: February 08, 2008, 02:16 PM »

thanx man. i took time to run some queries direct on the mssql den debug straight from there. its now working fine.

thanx.
 Fellas Please Help And Explain  How To Get A Magstripe Reader With Interfacable Software  Help To Improve This Site Www.miclad.com And Www.miclad.com/auc1  Page 2
Pages: (1) Go Up Send Topic to Friend by E-mail Reply 
Google
 
Web www.nairaland.com
Sections: TV/Movies (2) Music/Radio (2) Celebrities Jobs (2) Career Romance Books Politics Sports Fashion Travel
Health Schooling Religion General(2) Business Webmaster Programming Computers Phones Cars & Trucks

Links: Page1 Page2 Page3 Page4 Page5 Page6 Page7 Page8 Page9 Page10

Nairaland is owned by Oluwaseun Osewa
Nairaland Forum | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.