Search results
Results from the WOW.Com Content Network
TRUNCATE is the DDL statement whereas DELETE is a DML statement. Below are the differences between the two: As TRUNCATE is a DDL (Data definition language) statement it does not require a commit to make the changes permanent. And this is the reason why rows deleted by truncate could not be rollbacked.
SELECT 'TRUNCATE TABLE '+TABLE_NAME+ ';' FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME LIKE 'TBL_ORDERS_20%' Now you have below Results for above Select Query. TRUNCATE TABLE TBL_ORDERS_2001 TRUNCATE TABLE TBL_ORDERS_2002 TRUNCATE TABLE TBL_ORDERS_2003 TRUNCATE TABLE TBL_ORDERS_2004 or you can use something like
Right-click the database, choose Properties, then Options. Make sure "Recovery model" is set to "Simple", not "Full". Click OK. Right-click the database again, choose Tasks -> Shrink -> Files. Change file type to "Log". Click OK. Alternatively, the SQL to do it: ALTER DATABASE mydatabase SET RECOVERY SIMPLE.
DROP and TRUNC do different things: TRUNCATE TABLE. Removes all rows from a table without logging the individual row deletions. TRUNCATE TABLE is similar to the DELETE statement with no WHERE clause; however, TRUNCATE TABLE is faster and uses fewer system and transaction log resources. DROP TABLE.
The number to be rounded. decimals => Required. The number of decimal places to round number to. operation => Optional. If 0, it rounds the result to the number of decimal. If another value than 0, it truncates the result to the number of decimals. Default value is 0. SELECT ROUND(235.415, 2, 1) will give you 235.410.
8. The minimum permission required is ALTER on table_name. TRUNCATE TABLE permissions default to the table owner, members of the sysadmin fixed server role, and the db_owner and db_ddladmin fixed database roles, and are not transferable. However, you can incorporate the TRUNCATE TABLE statement within a module, such as a stored procedure, and ...
Using MSSQL2005, can I truncate a table with a foreign key constraint if I first truncate the child table (the table with the primary key of the FK relationship)? I know that I can either Use a D...
In SQL 2005, your trunc_date function could be written like this. The first method is much much cleaner. It uses only 3 method calls including the final CAST() and performs no string concatenation, which is an automatic plus.
select. left(col, 15) + '...' col. from yourtable. See SQL Fiddle with Demo. This will return the first 15 characters of the string and then concatenates the ... to the end of it. If you want to to make sure than strings less than 15 do not get the ... then you can use: select. case. when len(col)>15.
So here's one way to solve your problem using the TRUNCATE statement: Simple, fast, but unsafe solution using TRUNCATE. 1. CREATE TABLE my_table_backup AS. SELECT * FROM my_table WHERE my_date>=DATE_SUB(NOW(), INTERVAL 1 MONTH); 2. TRUNCATE my_table; 3. LOCK TABLE my_table WRITE, my_table_backup WRITE;