<p>I am walking through the MS Press Windows Workflow Step-by-Step book and in chapter 8 it mentions a tool with the filename "wca.exe".  This is supposed to be able to generate workflow communication helper classes based on an interface you provide it.  I can't find that file.  I thought it would be in the latest .NET 3.5 SDK, but I just downloaded and fully installed, and it's not there.  Also, some MSDN forum posts had links posted that just go to 404s.  So, where can I find wca.exe?</p>

[{'answer_id': 4394, 'author': 'Xenph Yan', 'author_id': 264, 'author_profile': 'https://Stackoverflow.com/users/264', 'pm_score': 7, 'selected': False, 'text': '<pre><code>SELECT \'DROP TABLE "\' + TABLE_NAME + \'"\' \nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_NAME LIKE \'[prefix]%\'\n</code></pre>\n\n<p>This will generate a script.</p>\n\n<p>Adding clause to check existence of table before deleting:</p>\n\n<pre><code>SELECT \'IF OBJECT_ID(\'\'\' +TABLE_NAME + \'\'\') IS NOT NULL BEGIN DROP TABLE [\' + TABLE_NAME + \'] END;\' \nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_NAME LIKE \'[prefix]%\'\n</code></pre>\n'}, {'answer_id': 4400, 'author': 'FryHard', 'author_id': 231, 'author_profile': 'https://Stackoverflow.com/users/231', 'pm_score': 2, 'selected': False, 'text': '<p><a href="https://stackoverflow.com/users/264/xenph-yan">Xenph Yan</a>\'s answer was far cleaner than mine but here is mine all the same.</p>\n\n<pre><code>DECLARE @startStr AS Varchar (20)\nSET @startStr = \'tableName\'\n\nDECLARE @startStrLen AS int\nSELECT @startStrLen = LEN(@startStr)\n\nSELECT \'DROP TABLE \' + name FROM sysobjects\nWHERE type = \'U\' AND LEFT(name, @startStrLen) = @startStr\n</code></pre>\n\n<p>Just change <code>tableName</code> to the characters that you want to search with.</p>\n'}, {'answer_id': 4401, 'author': 'Curt Hagenlocher', 'author_id': 533, 'author_profile': 'https://Stackoverflow.com/users/533', 'pm_score': 8, 'selected': True, 'text': '\n\n<p>You may need to modify the query to include the owner if there\'s more than one in the database.</p>\n\n<pre class="lang-sql prettyprint-override"><code>DECLARE @cmd varchar(4000)\nDECLARE cmds CURSOR FOR\nSELECT \'drop table [\' + Table_Name + \']\'\nFROM INFORMATION_SCHEMA.TABLES\nWHERE Table_Name LIKE \'prefix%\'\n\nOPEN cmds\nWHILE 1 = 1\nBEGIN\n    FETCH cmds INTO @cmd\n    IF @@fetch_status != 0 BREAK\n    EXEC(@cmd)\nEND\nCLOSE cmds;\nDEALLOCATE cmds\n</code></pre>\n\n<p>This is cleaner than using a two-step approach of generate script plus run.  But one advantage of the script generation is that it gives you the chance to review the entirety of what\'s going to be run before it\'s actually run.</p>\n\n<p>I know that if I were going to do this against a production database, I\'d be as careful as possible.</p>\n\n<p><strong>Edit</strong> Code sample fixed.</p>\n'}, {'answer_id': 189920, 'author': 'Cade Roux', 'author_id': 18255, 'author_profile': 'https://Stackoverflow.com/users/18255', 'pm_score': 3, 'selected': False, 'text': "<pre><code>CREATE PROCEDURE usp_GenerateDROP\n    @Pattern AS varchar(255)\n    ,@PrintQuery AS bit\n    ,@ExecQuery AS bit\nAS\nBEGIN\n    DECLARE @sql AS varchar(max)\n\n    SELECT @sql = COALESCE(@sql, '') + 'DROP TABLE [' + TABLE_NAME + ']' + CHAR(13) + CHAR(10)\n    FROM INFORMATION_SCHEMA.TABLES\n    WHERE TABLE_NAME LIKE @Pattern\n\n    IF @PrintQuery = 1 PRINT @sql\n    IF @ExecQuery = 1 EXEC (@sql)\nEND\n</code></pre>\n"}, {'answer_id': 17281642, 'author': 'Shashank', 'author_id': 2517289, 'author_profile': 'https://Stackoverflow.com/users/2517289', 'pm_score': 1, 'selected': False, 'text': "<pre><code>select 'DROP TABLE ' + name from sysobjects\nwhere type = 'U' and sysobjects.name like '%test%'\n</code></pre>\n\n<p>-- Test is the table name</p>\n"}, {'answer_id': 21671836, 'author': "Tony O'Hagan", 'author_id': 365261, 'author_profile': 'https://Stackoverflow.com/users/365261', 'pm_score': 4, 'selected': False, 'text': "<p>This will get you the tables in foreign key order and avoid dropping some of the tables created by SQL Server. The <code>t.Ordinal</code> value will slice the tables into dependency layers.</p>\n\n<pre><code>WITH TablesCTE(SchemaName, TableName, TableID, Ordinal) AS\n(\n    SELECT OBJECT_SCHEMA_NAME(so.object_id) AS SchemaName,\n        OBJECT_NAME(so.object_id) AS TableName,\n        so.object_id AS TableID,\n        0 AS Ordinal\n    FROM sys.objects AS so\n    WHERE so.type = 'U'\n        AND so.is_ms_Shipped = 0\n        AND OBJECT_NAME(so.object_id)\n        LIKE 'MyPrefix%'\n\n    UNION ALL\n    SELECT OBJECT_SCHEMA_NAME(so.object_id) AS SchemaName,\n        OBJECT_NAME(so.object_id) AS TableName,\n        so.object_id AS TableID,\n        tt.Ordinal + 1 AS Ordinal\n    FROM sys.objects AS so\n        INNER JOIN sys.foreign_keys AS f\n            ON f.parent_object_id = so.object_id\n                AND f.parent_object_id != f.referenced_object_id\n        INNER JOIN TablesCTE AS tt\n            ON f.referenced_object_id = tt.TableID\n    WHERE so.type = 'U'\n        AND so.is_ms_Shipped = 0\n        AND OBJECT_NAME(so.object_id)\n        LIKE 'MyPrefix%'\n)\nSELECT DISTINCT t.Ordinal, t.SchemaName, t.TableName, t.TableID\nFROM TablesCTE AS t\n    INNER JOIN\n    (\n        SELECT\n            itt.SchemaName AS SchemaName,\n            itt.TableName AS TableName,\n            itt.TableID AS TableID,\n            Max(itt.Ordinal) AS Ordinal\n        FROM TablesCTE AS itt\n        GROUP BY itt.SchemaName, itt.TableName, itt.TableID\n    ) AS tt\n        ON t.TableID = tt.TableID\n            AND t.Ordinal = tt.Ordinal\nORDER BY t.Ordinal DESC, t.TableName ASC\n</code></pre>\n"}, {'answer_id': 25082268, 'author': 'RGH', 'author_id': 1908292, 'author_profile': 'https://Stackoverflow.com/users/1908292', 'pm_score': 1, 'selected': False, 'text': '<pre><code>SELECT \'if object_id(\'\'\' + TABLE_NAME + \'\'\') is not null begin drop table "\' + TABLE_NAME + \'" end;\' \nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_NAME LIKE \'[prefix]%\'\n</code></pre>\n'}, {'answer_id': 28533145, 'author': 'Xaxum', 'author_id': 873487, 'author_profile': 'https://Stackoverflow.com/users/873487', 'pm_score': 1, 'selected': False, 'text': "<p>I had to do a slight derivation on Xenph Yan's answer I suspect because I had tables not in the default schema.  </p>\n\n<pre><code>SELECT 'DROP TABLE Databasename.schema.' + TABLE_NAME \nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_NAME LIKE 'strmatch%'\n</code></pre>\n"}, {'answer_id': 30372503, 'author': 'Rosdi Kasim', 'author_id': 193634, 'author_profile': 'https://Stackoverflow.com/users/193634', 'pm_score': 3, 'selected': False, 'text': '<p>On Oracle XE this works:</p>\n\n<pre><code>SELECT \'DROP TABLE "\' || TABLE_NAME || \'";\'\nFROM USER_TABLES\nWHERE TABLE_NAME LIKE \'YOURTABLEPREFIX%\'\n</code></pre>\n\n<p>Or if you want to <strong>remove the constraints and free up space</strong> as well, use this:</p>\n\n<pre><code>SELECT \'DROP TABLE "\' || TABLE_NAME || \'" cascade constraints PURGE;\'\nFROM USER_TABLES\nWHERE TABLE_NAME LIKE \'YOURTABLEPREFIX%\'\n</code></pre>\n\n<p>Which will generate a bunch of <code>DROP TABLE cascade constraints PURGE</code> statements...</p>\n\n<p>For <code>VIEWS</code> use this:</p>\n\n<pre><code>SELECT \'DROP VIEW "\' || VIEW_NAME || \'";\'\nFROM USER_VIEWS\nWHERE VIEW_NAME LIKE \'YOURVIEWPREFIX%\'\n</code></pre>\n'}, {'answer_id': 31668613, 'author': 'talsibony', 'author_id': 1220652, 'author_profile': 'https://Stackoverflow.com/users/1220652', 'pm_score': 3, 'selected': False, 'text': "<p>I saw this post when I was looking for mysql statement to drop all WordPress tables based on @Xenph Yan here is what I did eventually:</p>\n\n<pre><code>SELECT CONCAT(  'DROP TABLE `', TABLE_NAME,  '`;' ) AS query\nFROM INFORMATION_SCHEMA.TABLES\nWHERE TABLE_NAME LIKE  'wp_%'\n</code></pre>\n\n<p>this will give you the set of drop queries for all tables begins with wp_</p>\n"}, {'answer_id': 36200064, 'author': 'vencedor', 'author_id': 2653457, 'author_profile': 'https://Stackoverflow.com/users/2653457', 'pm_score': 3, 'selected': False, 'text': "<p>Here is my solution:</p>\n\n<pre><code>SELECT CONCAT('DROP TABLE `', TABLE_NAME,'`;') \nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_NAME LIKE 'TABLE_PREFIX_GOES_HERE%';\n</code></pre>\n\n<p>And of course you need to replace <code>TABLE_PREFIX_GOES_HERE</code> with your prefix.</p>\n"}, {'answer_id': 37708151, 'author': 'mrosiak', 'author_id': 3242203, 'author_profile': 'https://Stackoverflow.com/users/3242203', 'pm_score': 3, 'selected': False, 'text': '<pre><code>EXEC sp_MSforeachtable \'if PARSENAME("?",1) like \'\'%CertainString%\'\' DROP TABLE ?\'\n</code></pre>\n\n<p><strong>Edit:</strong></p>\n\n<p>sp_MSforeachtable is undocumented hence not suitable for production because it\'s behavior may vary depending on MS_SQL version.</p>\n'}, {'answer_id': 39347828, 'author': 'João Mergulhão', 'author_id': 6795613, 'author_profile': 'https://Stackoverflow.com/users/6795613', 'pm_score': 1, 'selected': False, 'text': '<p>In case of temporary tables, you might want to try </p>\n\n<pre><code>SELECT \'DROP TABLE "\' + t.name + \'"\' \nFROM tempdb.sys.tables t\nWHERE t.name LIKE \'[prefix]%\'\n</code></pre>\n'}, {'answer_id': 57511478, 'author': 'ASH', 'author_id': 5212614, 'author_profile': 'https://Stackoverflow.com/users/5212614', 'pm_score': 2, 'selected': False, 'text': "<p>This worked for me.</p>\n\n<pre><code>DECLARE @sql NVARCHAR(MAX) = N'';\n\nSELECT @sql += '\nDROP TABLE ' \n    + QUOTENAME(s.name)\n    + '.' + QUOTENAME(t.name) + ';'\n    FROM sys.tables AS t\n    INNER JOIN sys.schemas AS s\n    ON t.[schema_id] = s.[schema_id] \n    WHERE t.name LIKE 'something%';\n\nPRINT @sql;\n-- EXEC sp_executesql @sql;\n</code></pre>\n"}, {'answer_id': 65718571, 'author': 'Tomasz Wieczorkowski', 'author_id': 2355469, 'author_profile': 'https://Stackoverflow.com/users/2355469', 'pm_score': 1, 'selected': False, 'text': "<p>I would like to post my proposal of the solution which DROP (not just generate and select a drop commands) all tables based on the wildcard (e.g. &quot;table_20210114&quot;) older than particular amount of days.</p>\n<pre><code>DECLARE \n    @drop_command NVARCHAR(MAX) = '',\n    @system_time date,\n    @table_date nvarchar(8),\n    @older_than int = 7\n    \nSet @system_time = (select getdate() - @older_than)\nSet @table_date = (SELECT CONVERT(char(8), @system_time, 112))\n\nSELECT @drop_command += N'DROP TABLE ' + QUOTENAME(SCHEMA_NAME(schema_id)) + '.' + QUOTENAME([Name]) + ';'\nFROM &lt;your_database_name&gt;.sys.tables\nWHERE [Name] LIKE 'table_%' AND RIGHT([Name],8) &lt; @table_date\n\nSELECT @drop_command\n \nEXEC sp_executesql @drop_command\n</code></pre>\n"}, {'answer_id': 71514887, 'author': 'Arthur Cam', 'author_id': 10475213, 'author_profile': 'https://Stackoverflow.com/users/10475213', 'pm_score': 1, 'selected': False, 'text': "<p>If your query returns more than one line, you can collect the results and merge them into a query.</p>\n<pre><code>declare @Tables as nvarchar(max) = '[schemaName].['\nselect @Tables =@Tables + TABLE_NAME +'],[schemaName].['\nFROM INFORMATION_SCHEMA.TABLES \nWHERE TABLE_TYPE='BASE TABLE'\nAND TABLE_SCHEMA = 'schemaName'\nAND TABLE_NAME like '%whateverYourQueryIs%'\n\nselect @Tables =  Left(@Tables,LEN(@Tables)-13) --trying to remove last &quot;,[schemaName].[&quot; part, so you need to change this 13 with actual lenght \n\n--print @Tables\n\ndeclare @Query as nvarchar(max) = 'Drop table ' +@Tables \n\n--print @Query\n\n\nexec sp_executeSQL @Query\n</code></pre>\n"}, {'answer_id': 73278269, 'author': 'AliNajafZadeh', 'author_id': 16746668, 'author_profile': 'https://Stackoverflow.com/users/16746668', 'pm_score': 0, 'selected': False, 'text': "<p>Try following code:</p>\n<pre><code>declare @TableLst table(TblNames nvarchar(500))\ninsert into @TableLst (TblNames)\nSELECT 'DROP TABLE [' + Table_Name + ']'\nFROM INFORMATION_SCHEMA.TABLES\nWHERE Table_Name LIKE 'yourFilter%'\nWHILE ((select COUNT(*) as CntTables from @TableLst) &gt; 0)\nBEGIN\n    declare @ForExecCms nvarchar(500) = (select top(1) TblNames from @TableLst)\n    EXEC(@ForExecCms)\n    delete from @TableLst where TblNames = @ForExecCms\nEND\n</code></pre>\n<p>This SQL script is executed without using a <strong>cursor</strong>.</p>\n"}]
['https://Stackoverflow.com/questions/4416', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/404/']