Reg: Migration
am 13.08.2010 09:34:43 von kranthi
------=_NextPart_000_0008_01CB3AE8.1A194B00
Content-Type: text/plain;
charset="us-ascii"
Content-Transfer-Encoding: 7bit
Hi ,
I am migrating the database from mssql server to Mysql.i am getting
problem with newid(),I don't know about newid(),i am using mysql migration
tool kit.
if anybody knows please help me.
Ex:
CREATE TABLE cust
(
cust_id uniqueidentifier NOT NULL
DEFAULT newid(),
company varchar(30) NOT NULL,
contact_name varchar(60) NOT NULL,
address varchar(30) NOT NULL,
city varchar(30) NOT NULL,
state_province varchar(10) NULL,
country varchar(20) NOT NULL,
)
GO
Thanks & Regards,
Kranthi
------=_NextPart_000_0008_01CB3AE8.1A194B00--
Re: Reg: Migration
am 13.08.2010 12:01:10 von Joerg Bruehe
Hi Kranthi!
Kranthi schrieb:
> Hi ,
>=20
> I am migrating the database from mssql server to Mysql.i am ge=
tting
> problem with newid(),I don't know about newid(),i am using mysql migrat=
ion
> tool kit.
>=20
> if anybody knows please help me.=20
>=20
> Ex:
>=20
> CREATE TABLE cust
> (
> cust_id uniqueidentifier NOT NULL
> DEFAULT newid(),
> [[...]]
> )
I don't know Microsoft SQL Server details, but this seems to be the
equivalent of what is called "auto_increment" in MySQL.
This might be a start point for reading:
http://dev.mysql.com/doc/refman/5.1/en/example-auto-incremen t.html
HTH,
Jörg
--=20
Joerg Bruehe, MySQL Build Team, joerg.bruehe@oracle.com
ORACLE Deutschland B.V. & Co. KG, Komturstrasse 18a, D-12099 Berlin
Geschaeftsfuehrer: Juergen Kunz, Marcel v.d. Molen, Alexander v.d. Ven
Amtsgericht Muenchen: HRA 95603
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=3Dgcdmg-mysql-2@m.gmane.o rg
Re: Reg: Migration
am 13.08.2010 12:26:29 von Lenz Grimmer
Hi,
On 08/13/10 09:34, Kranthi wrote:
> I am migrating the database from mssql server to Mysql.i am getting
> problem with newid(),I don't know about newid(),i am using mysql migration
> tool kit.
>
> if anybody knows please help me.
Would using the UUID() MySQL function work for you in this case?
http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functio ns.html#function_uuid
Bye,
Lenz
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: Migration
am 13.08.2010 13:05:26 von kranthi
Hi Lenz,
I used UUID() function, I am getting error "Check the manual that
corresponds to your mysql server version for the right syntax to use near
UUID()". I am using mysql version 5.0.45.
DROP TABLE IF EXISTS `AdventureWorks_HumanResources`.`Employee`;
CREATE TABLE `AdventureWorks_HumanResources`.`Employee` (
`EmployeeID` INT(10) NOT NULL AUTO_INCREMENT,
`NationalIDNumber` VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_general_ci
NOT NULL,
`ContactID` INT(10) NOT NULL,
`LoginID` VARCHAR(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT
NULL,
`ManagerID` INT(10) NULL,
`Title` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`BirthDate` DATETIME NOT NULL,
`MaritalStatus` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT
NULL,
`Gender` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
`HireDate` DATETIME NOT NULL,
`SalariedFlag` TINYINT NOT NULL DEFAULT 1,
`VacationHours` SMALLINT(5) NOT NULL DEFAULT 0,
`SickLeaveHours` SMALLINT(5) NOT NULL DEFAULT 0,
`CurrentFlag` TINYINT NOT NULL DEFAULT 0,
`rowguid` VARCHAR(64) NOT NULL DEFAULT uuid(), -- Here I am using UUID()
instead of newid()
PRIMARY KEY (`EmployeeID`)
)
ENGINE = INNODB;
Thanks & Regards,
Kranthi
-----Original Message-----
From: Lenz Grimmer [mailto:lenz@mysql.com]
Sent: Friday, August 13, 2010 3:56 PM
To: mysql@lists.mysql.com
Subject: Re: Reg: Migration
Hi,
On 08/13/10 09:34, Kranthi wrote:
> I am migrating the database from mssql server to Mysql.i am
getting
> problem with newid(),I don't know about newid(),i am using mysql migration
> tool kit.
>
> if anybody knows please help me.
Would using the UUID() MySQL function work for you in this case?
http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functio ns.html#function
_uuid
Bye,
Lenz
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:
http://lists.mysql.com/mysql?unsub=kranthi_pentyala@iicindia .com
--
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org
RE: Migration
am 13.08.2010 13:14:48 von John Daisley
Hi Lenz,
You cannot use UUID() or indeed any other function (with the exception
of current_timestamp) as the default value for a column
As per the manual at
http://dev.mysql.com/doc/refman/5.1/en/create-table.html
The DEFAULT clause specifies a default value for a column. With
one exception, the default value must be a constant; it cannot
be a function or an expression. This means, for example, that
you cannot set the default for a date column to be the value of
a function such as NOW() or CURRENT_DATE. The exception is that
you can specify CURRENT_TIMESTAMP as the default for a TIMESTAMP
column.
The way around this is to have a trigger set the column value to UUID()
Regards
John Daisley
--------------------------------------
John Daisley
Certified MySQL 5 Database Administrator
Certified MySQL 5 Developer
Cognos BI Developer
MS SQL Server 2005 Database Administrator
Telephone: +44 (0)7918 621621
Email: john.daisley@butterflysystems.co.uk
On Fri, 2010-08-13 at 16:35 +0530, Kranthi wrote:
> Hi Lenz,
> I used UUID() function, I am getting error "Check the manual that
> corresponds to your mysql server version for the right syntax to use near
> UUID()". I am using mysql version 5.0.45.
>
>
> DROP TABLE IF EXISTS `AdventureWorks_HumanResources`.`Employee`;
> CREATE TABLE `AdventureWorks_HumanResources`.`Employee` (
> `EmployeeID` INT(10) NOT NULL AUTO_INCREMENT,
> `NationalIDNumber` VARCHAR(15) CHARACTER SET utf8 COLLATE utf8_general_ci
> NOT NULL,
> `ContactID` INT(10) NOT NULL,
> `LoginID` VARCHAR(256) CHARACTER SET utf8 COLLATE utf8_general_ci NOT
> NULL,
> `ManagerID` INT(10) NULL,
> `Title` VARCHAR(50) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
> `BirthDate` DATETIME NOT NULL,
> `MaritalStatus` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT
> NULL,
> `Gender` CHAR(1) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL,
> `HireDate` DATETIME NOT NULL,
> `SalariedFlag` TINYINT NOT NULL DEFAULT 1,
> `VacationHours` SMALLINT(5) NOT NULL DEFAULT 0,
> `SickLeaveHours` SMALLINT(5) NOT NULL DEFAULT 0,
> `CurrentFlag` TINYINT NOT NULL DEFAULT 0,
> `rowguid` VARCHAR(64) NOT NULL DEFAULT uuid(), -- Here I am using UUID()
> instead of newid()
> PRIMARY KEY (`EmployeeID`)
> )
> ENGINE = INNODB;
>
>
>
> Thanks & Regards,
> Kranthi
>
>
>
> -----Original Message-----
> From: Lenz Grimmer [mailto:lenz@mysql.com]
> Sent: Friday, August 13, 2010 3:56 PM
> To: mysql@lists.mysql.com
> Subject: Re: Reg: Migration
>
> Hi,
>
> On 08/13/10 09:34, Kranthi wrote:
>
> > I am migrating the database from mssql server to Mysql.i am
> getting
> > problem with newid(),I don't know about newid(),i am using mysql migration
> > tool kit.
> >
> > if anybody knows please help me.
>
> Would using the UUID() MySQL function work for you in this case?
>
> http://dev.mysql.com/doc/refman/5.1/en/miscellaneous-functio ns.html#function
> _uuid
>
> Bye,
>
> Lenz
>
> --
> MySQL General Mailing List
> For list archives: http://lists.mysql.com/mysql
> To unsubscribe:
> http://lists.mysql.com/mysql?unsub=kranthi_pentyala@iicindia .com
>
>
>
> --
>
>
--
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe: http://lists.mysql.com/mysql?unsub=gcdmg-mysql-2@m.gmane.org