SQL Prompt - 5.3
Preparing the table in detail
To plan how the columns in the table are to be split and to prepare your data appropriately, consider the following points.
Copying columns
You must ensure that at least one column is copied to the secondary table so that it exists in both tables. SQL Prompt uses the copied columns to create the foreign key, and the primary key for the secondary table. Therefore, before you open the Split Table wizard, you must ensure that the primary table contains the columns that you want to copy. The values contained within the copied columns must uniquely identify each row of data in the secondary table.
Data
For columns that remain in the primary table, all data is retained.
For columns that are copied or moved to the secondary table, SQL Prompt uses the DISTINCT keyword when possible to ensure that only unique data is copied or moved.
However, for the following data types the DISTINCT keyword cannot be used:
- XML data
- SQL Server 2000 large object (LOB) data (text, ntext, image)
Therefore, if you choose to move or copy any of these data types, SQL Prompt cannot use the DISTINCT keyword when the secondary table is populated. This means that all data is moved or copied to the secondary table, including any duplicate data. If the copied columns contain duplicate data, the primary key cannot be created on these columns, and the script will fail.
Computed columns
If you move or copy a computed column, you must ensure that any columns that are referenced by the computed column are also moved or copied. If you do not do this, SQL Prompt displays a warning, and you cannot generate the script.
If you copy a computed column and all its referenced columns, and the computed column is persisted, SQL Prompt converts the computed column to a normal column in the secondary table so that data is retained. For example, a column that computes two columns that have data type char(50) is changed to a normal column of data type char(100).
If you copy a computed column and all its referenced columns, and the computed column is not persisted, SQL Prompt displays a warning; if you have chosen to create the foreign key on the secondary table, the script will fail because it is not possible to create a foreign key on a column that is not persisted.
If you move a computed column and all its referenced columns, the computed column remains a computed column in the secondary table.
You cannot move a column from the primary table if it is required by a computed column in the primary table (but you can copy it).
XML columns
XML columns cannot be copied because a primary key cannot be created on an XML column.
Large object data
Columns that contain large object (LOB) data cannot be copied because a primary key cannot be created on LOB data.
Timestamp columns
Timestamp columns cannot be copied or moved. This is because data cannot be inserted into timestamp columns and the original values cannot, therefore, be inserted into the secondary table.
Common language runtime data
If a common language runtime (CLR) data column is copied or moved to the secondary table and the CLR data is not byte ordered (IsByteOrder is false), the script will fail. This is because the DISTINCT keyword cannot be used on a CLR column that is not byte ordered
NULL values
NULL values are not allowed in copied columns in the secondary table. This is because the copied columns are used to create the primary key on the secondary table, and primary key columns cannot contain NULL values.
If any columns that you copy allow NULL values, a warning is displayed. When the script is run, these columns will be modified to disallow NULLs (set to NOT NULL).
If any of the data in the copied columns contains NULL values, the script will fail.
Identities
If you copy or move an identity column, the identity is copied or moved, and data will be inserted using the IDENTITY_INSERT setting.
Partition schemes
You cannot move a column over which the primary table is partitioned to the secondary table. If you attempt to do this, SQL Prompt displays a warning. You can, however, copy the column if required.
DML triggers
All DML triggers that access the data in the primary table are dropped. You are recommended to save these triggers prior to running the split table script if you will want to recreate them following the split.
Triggers that do not access the primary table are preserved, but are not duplicated on the secondary table.
Was this article helpful?
SQL Prompt
- SSMS failed to load SQL Prompt add-in 80070002
- No SQL Prompt menu appears in Query Analyzer
- SQL Prompt is showing an old version of my stored procedure (version 3)
- Removing menu items after uninstalling SQL Prompt and SQL Refactor
- A newly-created table exists, but it is not visible in the candidate list (version 3)
- Configuring permissions for SQL Prompt
- Using Intellisense or auto complete with a VS Web project (version 3.5)
- Uninstalling the Visual Studio 2005 add-in
- Unable to cast object of type 'System.DBNull' to type 'System.String' (version 3)
- Suggestions to improve performance for pre-formatted SQL (version 3.9)
- Changing the location of the settings, cache files and snippets folders
- Saving SQL Prompt options (version 3)
- SQL 2008 installation fails with Express Tools rule (version 3.8)
- Add-in failing to load into SQL Server Management Studio on Vista
- Removing SQL Server Management Studio Integration after uninstallation
- Layout SQL Error
- Downgrading to SQL prompt 3.9 from 4.0
- Candidate suggestions being displayed slowly
- SQL Prompt is not showing all linked servers
- Log files
- Refreshing the cache
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Prompt
- Activating your products
- Activating your products
- Getting help offline
- Customizing SQL Prompt to write SQL code more efficiently
- SQL Prompt 3.xx - reducing memory usage to improve performance
- Using SQL Prompt 4: tips for SQL Prompt 3 users
- SQL Prompt release notes - version 4.xx
- Release notes - version 5.xx
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Using SQL Prompt