Delete All Rows except headers from SQL table using Alteryx
Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Mute
- Printer Friendly Page
Puneet13
8 - Asteroid
‎09-13-2023
05:02 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Hi Everyone
Can anybody help me to provide SQL query which deletes all records except headers from SQL Table,
Thanks
5 REPLIES 5
11 - Bolide
‎09-13-2023
05:12 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
What type of database do you need SQL for? i.e. MS SQL Server, Oracle, etc.
‎09-13-2023
05:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
MS SQL server
11 - Bolide
‎09-13-2023
05:17 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
To delete all of the data, but keep the table use this code changing target_table to your table name: DELETE FROM target_table;
‎09-13-2023
05:32 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
I Have tried but it giving the attached error.
11 - Bolide
‎09-13-2023
05:36 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Notify Moderator
Normally when I receive that error, there is a spacing issue in the SQL related to copy/pasting. Try deleting all of the spaces and adding them back.
