473,385 Members | 1,642 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

SQLServer 2000 Conversion

Hey all,

I have a web app that uses SQLServer 2000. I am switching to MySQL 4.

1.1. I have re-created all the tables but I'm running into 2 problems.


1. In SQLServer I can create a date field and as the default value I

can use a macro/function to have it set the default. I have not seen

an equivalent in MySQL. After doing some research I have seen only

two possible solutions:

a) Use timestamp. This is not suitable because it has a tendency to
auto update and it's more trouble than it's worth to use a field that
does this when you know it should never really change.

b) Use datetime and just insert the time in. This option will
require

me to mess in the web app and go through and change SQL which I

really would rather not have to do but will as a very last resort. I

prefer the database to handle this sort of thing.

So am I missing something? Or does MySQL simply not support using

macros or functions as default values like SQLServer does?

2. Second problem may not be MySQL. I use Naicat and I created a

varchar field with a length of 2. When I saved the table it was

converted to a char of length 2. This was not cool because the two

are not equivalent. I don't care how much faster char is. So my

question is, is there something in MySQL that doesn't allow varchars

of length < 4 or is this a Navcat thing?

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
=-

Stormblade (Shaolin Code Warrior)

Software Developer (15+ Years Programming exp.)

My System: http://www.anandtech.com/mysystemrig.html?rigid=1683

-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-

Jul 20 '05 #1
3 1698

"Stormblade" <st********@bellsouth.net> wrote in message
news:kC*******************@fe19.usenetserver.com.. .
Hey all, [snip] two possible solutions:
a) Use timestamp. This is not suitable because it has a tendency to
auto update and it's more trouble than it's worth to use a field that
does this when you know it should never really change.

b) Use datetime and just insert the time in. This option will
require
me to mess in the web app and go through and change SQL which I

really would rather not have to do but will as a very last resort. I
prefer the database to handle this sort of thing.

So am I missing something? Or does MySQL simply not support using
macros or functions as default values like SQLServer does?

Well, one big difference..the order of the timestamp filed in MySQL matters.
Yes,
so be careful when using alter table statements.

create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

The first timestamp will always be the "automatically generated" time.
So
if the record is updated, or inserted, this time gets changed. If the
order is changed with an alter table statement, "timeEnter" is before
"timeUpdate", then, "timeEnter" would get updated. First timestamp
column updates automatically.

Note, in the table above timeEnter will only get updated if passed a
null
value.

insert into t (a,b,timeEnter) values (1,2,NULL);

May want to reference the following (TIP 3:)
http://osdn.dl.sourceforge.net/sourc...ADME_mysql.txt
Regards,

Mike Chirico
Jul 20 '05 #2

"Stormblade" <st********@bellsouth.net> wrote in message
news:kC*******************@fe19.usenetserver.com.. .
Hey all, [snip] two possible solutions:
a) Use timestamp. This is not suitable because it has a tendency to
auto update and it's more trouble than it's worth to use a field that
does this when you know it should never really change.

b) Use datetime and just insert the time in. This option will
require
me to mess in the web app and go through and change SQL which I

really would rather not have to do but will as a very last resort. I
prefer the database to handle this sort of thing.

So am I missing something? Or does MySQL simply not support using
macros or functions as default values like SQLServer does?

Well, one big difference..the order of the timestamp filed in MySQL matters.
Yes,
so be careful when using alter table statements.

create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

The first timestamp will always be the "automatically generated" time.
So
if the record is updated, or inserted, this time gets changed. If the
order is changed with an alter table statement, "timeEnter" is before
"timeUpdate", then, "timeEnter" would get updated. First timestamp
column updates automatically.

Note, in the table above timeEnter will only get updated if passed a
null
value.

insert into t (a,b,timeEnter) values (1,2,NULL);

May want to reference the following (TIP 3:)
http://osdn.dl.sourceforge.net/sourc...ADME_mysql.txt
Regards,

Mike Chirico
Jul 20 '05 #3

"Stormblade" <st********@bellsouth.net> wrote in message
news:kC*******************@fe19.usenetserver.com.. .
Hey all, [snip] two possible solutions:
a) Use timestamp. This is not suitable because it has a tendency to
auto update and it's more trouble than it's worth to use a field that
does this when you know it should never really change.

b) Use datetime and just insert the time in. This option will
require
me to mess in the web app and go through and change SQL which I

really would rather not have to do but will as a very last resort. I
prefer the database to handle this sort of thing.

So am I missing something? Or does MySQL simply not support using
macros or functions as default values like SQLServer does?

Well, one big difference..the order of the timestamp filed in MySQL matters.
Yes,
so be careful when using alter table statements.

create table t (
a int,
b int,
timeUpdate timestamp,
timeEnter timestamp );

The first timestamp will always be the "automatically generated" time.
So
if the record is updated, or inserted, this time gets changed. If the
order is changed with an alter table statement, "timeEnter" is before
"timeUpdate", then, "timeEnter" would get updated. First timestamp
column updates automatically.

Note, in the table above timeEnter will only get updated if passed a
null
value.

insert into t (a,b,timeEnter) values (1,2,NULL);

May want to reference the following (TIP 3:)
http://osdn.dl.sourceforge.net/sourc...ADME_mysql.txt
Regards,

Mike Chirico
Jul 20 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Stormblade | last post by:
Hey all, I have a web app that uses SQLServer 2000. I am switching to MySQL 4. 1.1. I have re-created all the tables but I'm running into 2 problems. 1. In SQLServer I can create a...
5
by: Steve | last post by:
Hi; I went to the microsoft site to try to find a guide to the error messages that the jdbc drivers give ( for sqlserver 2000 ). I had no luck. Does anyone know if there is such a guide? ...
2
by: Patrox | last post by:
Hi ! when installing sqlserver 2000 on a Windows 2003 server it explicitly tells "server not compatible with Windows 2003" during install, but it can carry on. After we applied serfice pack 3a...
0
by: williams | last post by:
I am trying to encrypt data in a SQLServer 2000 Cluster using Microsoft EFS. I have successfully encrypted a standalone DB but we are having difficulty with the Cluster. I am only encrypting the...
3
by: Devonish | last post by:
I am planning to convert an existing Access database which has a back end (data tables and relationships only) on a server and a copy of the front end (form, queries, reports) on each of about a...
4
by: icebrrrg | last post by:
Hi. I have some functionality in a C# DLL that I would like to be able to call from inside SQLServer. I know this was possible in C++, using an Extended Stored Procedure, but I haven't been able to...
14
by: Roy Gourgi | last post by:
Hi, I need to store and retrieve information from a database. It looks as though there is a lot more support for SQLServer than there is for Access, correct me if I am wrong. What do I have...
3
by: Dan Sikorsky | last post by:
Can I use SQLServer 2000 with ASP.NET 2.0 instead of SQLServer 2005, and use the .Net 2.0 Membership functionality? I've setup my Login page, controls, etc., and now it's time to use the Web...
8
by: Darryl Kerkeslager | last post by:
Currently I am using the RegExp object to parse a large dataset in an Access table - but this table was exported from SQL Server, and the very correct question was asked - why not just do it in SQL...
2
by: =?Utf-8?B?SmVmZnJleQ==?= | last post by:
I have some old ASP programs w/ SQLserver 2000 databases. Now I am developing ASP.NET projects using VB 2005 and SQLserver 2005. What are the best procedures to develop and test the ASP.NET...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.