472,364 Members | 1,775 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,364 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 1642

"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...
2
by: Kemmylinns12 | last post by:
Blockchain technology has emerged as a transformative force in the business world, offering unprecedented opportunities for innovation and efficiency. While initially associated with cryptocurrencies...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
by: antdb | last post by:
Ⅰ. Advantage of AntDB: hyper-convergence + streaming processing engine In the overall architecture, a new "hyper-convergence" concept was proposed, which integrated multiple engines and...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and credentials and received a successful connection...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the synthesis of my design into a bitstream, not the C++...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...

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.