William
Wed Jun 02 10:24:07 CDT 2004
Use GetSchemaTable I don't think you can if you need to match them exactly.
I misunderstood the end game. Why not use Information_Schema instead and or
write something on the DB side to do the recreation. If the two dbs can see
each other , this is cake. If they can't the pull the info down from
Information_Schema (will only work with SQL SErver) and grab it from there.
ie
Select * From INformation_Schema.Columns TableName. Then you can just fire
this with a reader or whatever and have the exact info you need.
--
W.G. Ryan, eMVP
http://forums.devbuzz.com/
http://www.knowdotnet.com/williamryan.html
http://www.msmvps.com/WilliamRyan/
http://www.devbuzz.com/content/zinc_personal_media_center_pg1.asp
"Bamse" <bdaniel7@yahoo.com> wrote in message
news:uionlLLSEHA.4020@TK2MSFTNGP11.phx.gbl...
> thank you, but the problem still remains...
>
> in the table schema I have this column <column_name> of type
System.String;
> to which sql type do I convert it? text, char, varchar
>
> as you know, the table schema contains only .NET data types that must be
> converted to sql types.
>
> "William Ryan eMVP" <dotnetguru@comcast.nospam.net> wrote in message
> news:%23PJ87yKSEHA.3944@tk2msftngp13.phx.gbl...
> > Here's the conversions, make sure you are using the correct ones.
> >
>
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatasqldbtypeclasstopic.asp
> >
> > --
> >
> > W.G. Ryan, eMVP
> >
> >
http://forums.devbuzz.com/
> >
http://www.knowdotnet.com/williamryan.html
> >
http://www.msmvps.com/WilliamRyan/
> >
http://www.devbuzz.com/content/zinc_personal_media_center_pg1.asp
> > "Bamse" <bdaniel7@yahoo.com> wrote in message
> > news:uJN3nsKSEHA.3420@TK2MSFTNGP11.phx.gbl...
> > > Hello all,
> > >
> > > the job is the following:
> > >
> > > given 2 databases I must recreate a table from one DB to another;
> > >
> > > right now i'm using .getTableSchema, get a datatable with schema, loop
> > > through all it's rows and build a "create table..." statement;
> > >
> > > but the problems apear:
> > > converting .NET types to sql types, column length mismatch
> (sql.text.16 ->
> > > .Net.System.String.2147483647) which throws an exception.
> > >
> > > Is there an elegant way of conversion?
> > >
> > > Thank you,
> > > Daniel
> > >
> > >
> >
> >
>
>