This is my technical area for troubleshooting and learning new programming skills and much more. Here, you will find answers on a wide range of technologies such as AI, Machine Learning, OpenAI, Databricks, ASP.NET, C#, Python, Microsoft Access, MySQL, Amazon Web Services, SQL Server, PL/SQL, JD Edwards, SAS, Salesforce, APIs, MVC, and many others. Please feel free to visit and join the discussion!
Tuesday, July 1, 2008
Mysql Data Transfer from one server to other server - mysqldump
mysqldump -u root -p password -h Host IP DatabaseName>Sql_Text_file.sql
2> this will create all tables and data with insert command.
3> copy this script and connect to remote server by using mysql query browser and run to insert/create database and table.
www.visli.com - hot deals
Transfer MySQL database from one server to another UNIX / Linux server
How to Identify and Delete Duplicate SQL Server Records
/**********************************************Example of a simple duplicate data delete script.**********************************************/
/**********************************************Set up test environment**********************************************/SET NOCOUNT ON
--Create test tableIF OBJECT_ID('tDupData') IS NOT NULLDROP TABLE tDupDataGO
CREATE TABLE tDupData(lngCompanyID INTEGER ,strCompanyName VARCHAR(20),strAddress VARCHAR(10),dtmModified DATETIME)
--Create test dataINSERT INTO tDupData VALUES (1,'CompanyOne','Address1','01/15/2003')INSERT INTO tDupData VALUES (2,'CompanyTwo','Address2','01/15/2003')INSERT INTO tDupData VALUES (3,'CompanyThree','Address3','01/15/2003')INSERT INTO tDupData VALUES (2,'CompanyTwo','Address','01/16/2003') INSERT INTO tDupData VALUES (3,'CompanyThree','Address','01/16/2003')
-- Dup Data INSERT INTO tDupData VALUES (1,'CompanyOne','Address1','01/15/2003') GO
/**********************************************Finish set up**********************************************/
/**********************************************Simple duplicate data**********************************************/select * from tDupData--Create temp table to hold duplicate dataCREATE TABLE #tempduplicatedata(lngCompanyID INTEGER ,strCompanyName VARCHAR(20),strAddress VARCHAR(10),dtmModified DATETIME)
--Identify and save dup data into temp tableINSERT INTO #tempduplicatedataSELECT * FROM tDupDataGROUP BY lngCompanyID,strCompanyName,strAddress, dtmModifiedHAVING COUNT(*) > 1
--Confirm number of dup rowsSELECT @@ROWCOUNT AS 'Number of Duplicate Rows'
--Delete dup from original tableDELETE FROM tDupData FROM tDupDataINNER JOIN #tempduplicatedataON tDupData.lngCompanyID = #tempduplicatedata.lngCompanyIDAND tDupData.strCompanyName = #tempduplicatedata.strCompanyNameAND tDupData.strAddress = #tempduplicatedata.strAddressAND tDupData.dtmModified = #tempduplicatedata.dtmModified
--Insert the delete data backINSERT INTO tDupDataSELECT * FROM #tempduplicatedata
--Check for dup data.SELECT * FROM tDupDataGROUP BY lngCompanyID,strCompanyName,strAddress,dtmModifiedHAVING COUNT(*) > 1
--Check tableSELECT * FROM tDupData
--Drop temp tableDROP TABLE #tempduplicatedata
--drop test tableIF OBJECT_ID('tDupData') IS NOT NULLDROP TABLE tDupDataGO
Version control for SQL databases with SQL -> XML
MySQL Datatypes Field Length
TINYINT
-128 to 127
integer
-32,768 to 32,767
*
TINYINT UNSIGNED
0 to 255
byte
0 to 255
SMALLINT
-32,768 to 32,767
integer
-32,768 to 32,767
SMALLINT UNSIGNED
0 to 65,535
long
-2,147,483,647 to 2,147,483,647
*
MEDIUMINT
-8,388,608 to 8,388,607
long
-2,147,483,647 to 2,147,483,647
*
MEDIUMINT UNSIGNED
0 to 16,777,215
long
-2,147,483,647 to 2,147,483,647
*
INT
-2,147,483,647 to 2,147,483,647
long
-2,147,483,647 to 2,147,483,647
INT UNSIGNED
0 to 4,294,967,295
double
64 Bit
1*
BIGINT
64 Bit
N/A
N/A
2
FLOAT
32 Bit Floating Point
single
32 Bit Floating Point
DOUBLE
64 Bit Floating Point
double
64 Bit Floating Point
DECIMAL
Variable Floating Point
double
64 Bit Floating Point
3*
CHAR
1 to 255 Characters
string
1 to Approx. 2,000,000,000 Characters
*
VARCHAR
1 to 255 Characters
string
1 to Approx. 2,000,000,000 Characters
*
TINYTEXT
1 to 255 Characters
string
1 to Approx. 2,000,000,000 Characters
*
TEXT
1 to 65535 Characters
string
1 to Approx. 2,000,000,000 Characters
4*
MEDIUMTEXT
1 to 16,777,215 Characters
string
1 to Approx. 2,000,000,000 Characters
4*
LONGTEXT
1 to 4,294,967,295 Characters
N/A
N/A
5
all BLOB types
1 to 4,294,967,295 Bytes
Variant
Varies
6
DATE
Date without Time
date
Date and Time value
*
DATETIME
Date and Time
date
Date and Time value
TIMESTAMP
Date and Time
date
Date and Time value
TIME
Time
date
Date and Time value
*
YEAR
Year
integer
-32,768 to 32,767
*
ENUM
Enumeration of Value Set
string
1 to Approx. 2,000,000,000 Characters
*
SET
Set of Values
string
1 to Approx. 2,000,000,000 Characters
*
Notes: