Focal Point Banner


As of December 1, 2020, Focal Point is retired and repurposed as a reference repository. We value the wealth of knowledge that's been shared here over the years. You'll continue to have access to this treasure trove of knowledge, for search purposes only. Moving forward, myibi is our community platform to learn, share, and collaborate. We have the same Focal Point forum categories in myibi, so you can continue to have all new conversations there. If you need access to myibi, contact us at myibi@ibi.com and provide your corporate email address, company, and name.


Connect to myibi
Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [Solved] delete or rename a SQL table via DataMigrator

Read-Only Read-Only Topic
Go
Search
Notify
Tools
[Solved] delete or rename a SQL table via DataMigrator
 Login/Join
 
Silver Member
posted
Is there a way to delete or rename a table from a SQL database using DataMigrator (Data Management Console)? I was hoping there would be something in the target properties I could use, but I don't see it. NOTE: I'm not asking about deleting all the records in the table (I know how to do that). I'm asking how to delete the SQL table from the database.

The database is on Microsoft SQL server version 13.00.4001, Windows 2016. I get to the SQL db via an Access 2010 Project. When this db was on an older server (Windows 2008), I could delete and rename tables (and do other things) via an Access 2010 Project. But things have changed on this new server.

Now, I get a message saying it can't find the object (that I've already selected) or this recordset is not updateable, or the stored procedure executed successfully but did not return records, or nothing happens when I try to delete it. And similar when trying to rename a table.

Thanks,
Mark

This message has been edited. Last edited by: folkie,


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016
 
Posts: 42 | Registered: September 08, 2003Report This Post
Member
posted Hide Post
Hi

You can create a procedure and use this to execute your DDL script to alter or drop the table


ENGINE SQLMSS SET DEFAULT_CONNECTION SQLCONN1
SQL SQLMSS COMMIT
SQL SQLMSS

DROP TABLE dbo.TBL1
-RUN


iWay Datamigrator 76,
iWay Service Manager 5.5, Windows server 2000,
 
Posts: 6 | Registered: April 15, 2009Report This Post
Silver Member
posted Hide Post
Tsepe,

Thanks for the info. I'm not very familiar with SQL other than what I used to be able to do via an Access Project, or with DataMigrator. I had to lookup what DDL means (Data Definition Language).

I created a new procedure and adapted the code you provided and it worked fine for deleting/dropping a table. I even learned how to drop multiple tables in one script (separate the table names with a comma).

But for renaming a table, ALTER didn't work for me (or I couldn't figure it out). I had to use a stored procedure called sp_rename because I’m using SQL Server - syntax: sp_rename 'Test_Table_Date1', 'Test_Table_Date2';

I like using comments wherever appropriate. But the DDL script didn’t seem to like too many comments (starting and ending with /* and */) and/or where I placed the comments.

But, based on your reply, I was able to do what I wanted.

Thanks a lot,
Mark


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016
 
Posts: 42 | Registered: September 08, 2003Report This Post
Silver Member
posted Hide Post
Regarding comments, I found that using the normal Focus comment of -* at the start of lines (instead of /* and */) works fine if I put them all at the top of the procedure. I didn't try to put them in the middle of the procedure.

Thanks,
Mark


WF 8.2.02
App Studio
DataMigrator
ReportCaster
Windows Server 2016
 
Posts: 42 | Registered: September 08, 2003Report This Post
  Powered by Social Strata  

Read-Only Read-Only Topic

Focal Point    Focal Point Forums  Hop To Forum Categories  iWay Software Product Forum on Focal Point    [Solved] delete or rename a SQL table via DataMigrator

Copyright © 1996-2020 Information Builders