Is there a tool to convert form one sql query of one Database to another .
> eg for sqite CREATE TABLE ConstantValues( Id int
> AUTOINCREMENT primary key ,
> VariableName varchar(50) , Values
> varchar(150) )
for sqlserver
> CREATE TABLE ConstantValues( Id
> INTEGER identity(1,1) primary key ,
> VariableName varchar(50) , Values
> varchar(150) )
similarly it is different for oracle and sqlserver, also in the foreign key constraints declaration,If there is a tool so that we can get sql from any database to any database it would be really helpful for me ...
I have created a function like this but it doesn't seem to be a good solution:
private string changeSQL(string sql)
{
switch (dbtype)
{
case dbType.SQLite:
sql = sql.Replace(" int ", " INTEGER ");
sql = sql.Replace(" identity(1,1) ", " AUTOINCREMENT ");
break;
case dbType.MsAscess:
sql = sql.Replace(" int ", " ");
sql = sql.Replace(" identity(1,1) ", "");
sql = sql.Replace("AUTOINCREMENT", "AUTOINCREMENT");
break;
}
return (sql);
}
Similarly for sqlite concatination is done using || while in sqlserver it is done using +