Adding columns to SQL Server tables dynamically

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Mark Rae (mark_at_mark-N-O-S-P-A-M-rae.co.uk)
Date: 12/04/04


Date: Sat, 4 Dec 2004 01:09:49 -0000

Hi,

I'm writing a routine which queries a table in a mySQL database and then
adds records from it into a SQL Server 2000 database - pretty easy stuff.

Problem is, that the mySQL table may have additional columns every time I
query it.

I can easily use the Columns collection of both tables to see if there is a
new column in the mySQL table which isn't in the SQL Server table, but
what's the easiest / most efficient way to add a new column to an existing
SQL Server table, given that I know the name and datatype of the column to
be added?

Would it be to pass some sort of "ALTER TABLE..." SQL into an SQLCommand
object, or is there a better way?

Any assistance gratefully received.

Best regards,

Mark Rae



Relevant Pages

  • Re: SQL server vs mySQL ???
    ... SQL Server has the broadest range of tools and support utilities of any database system on the planet--by far. ... MS SQL versus MySQL? ... As of 5.0, MySQL finally supports stored procedures, so they are very similar there (you can genericize your data access a bit due to sprocs in both). ...
    (microsoft.public.dotnet.framework.adonet)
  • RE: Transfer LARGE DB from MySQL to SQL Server 2K5 problems
    ... newsgroups are managed (and making that a selling point for MSDN ... forums, which, needless to say, drives me away from the MS web sites, and is ... I am going through the MySQL ODBC v3.51 driver, ... streaming across the wire to my SQL Server box. ...
    (microsoft.public.sqlserver.dts)
  • Re: Newbie, True and False
    ... All commands, Insert, Update etc work fine with MySql, but not with MsSql. ... First time working on an SQL database. ... will need to relearn when using sql server. ...
    (microsoft.public.sqlserver.clients)
  • Re: Access 2007 and MySQL
    ... Anyone tried MySQL as backend for recent Acc2k7 FE developments? ... You can however if you want choose SQL server for your back end and then you ... For the most part most your recordset code and most queries should work as ... Set rstRecords = CurrentDb.OpenRecordset ...
    (comp.databases.ms-access)
  • Re: SQL server vs mySQL ???
    ... The easiest way to support multiple databases is to work with a data access ... This question changes depending on which version of MySQL one has. ... * SQL Server has richer trigger support ...
    (microsoft.public.dotnet.framework.adonet)