truncate command in ODBC
Moderators: chulett, rschirm, roy
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
DSguru i tried removing the semi colon still it is showing as invalid command , as mentioned earlier DELETE command is working fine but it will take more time than TRUNCATE .........my aim is to increase the performance of the job. i dnt know how it worked when i ran with the sample rec????????
hi sam here
Let me ask you this, can you execute a stored procedure from the OPEN command fine ???
If yes then just create a small stored procedure that truncates that table. Three or four lines of code for the stored procedure. Thats it. Atleast you dont have to worry about when it will/will not work and why.
If yes then just create a small stored procedure that truncates that table. Three or four lines of code for the stored procedure. Thats it. Atleast you dont have to worry about when it will/will not work and why.
Creativity is allowing yourself to make mistakes. Art is knowing which ones to keep.
-
- Charter Member
- Posts: 822
- Joined: Sat Sep 17, 2005 5:25 pm
- Location: USA
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
i tested with sample data again and still it is giving this fatal
main_program: Fatal Error: Invalid open command : TRUNCATE TABLE ERR_TIER_BILLING_SUMMARY ;
i also tried without semicolon i dint work. I think i should try using the stored procedure as suggested by DSguru but not sure whether OPEN COMMAND works to execute the STORE PROC.[/code]
main_program: Fatal Error: Invalid open command : TRUNCATE TABLE ERR_TIER_BILLING_SUMMARY ;
i also tried without semicolon i dint work. I think i should try using the stored procedure as suggested by DSguru but not sure whether OPEN COMMAND works to execute the STORE PROC.[/code]
hi sam here
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
-
- Premium Member
- Posts: 397
- Joined: Wed Apr 12, 2006 2:28 pm
- Location: Tennesse
quick thought
Hi all,
Just a quick thought (or two) on this:
1. Are there any foreign keys pointing to the table? If so, SQL Server doesn't allow truncate against a table that is referenced by FK's.
2. Instead of a semi-colon, have you used the tried and true GO keyword? I realize it's ancient and hokey, but it still works well as far as I know. So the command would look something like 'TRUNCATE TABLE ERR_TIER_BILLING_SUMMARY GO' (without the quotes)
I make no warrantees or guarantees either quick suggestion will work, but it's something I haven't seen written yet.
Bestest!
Just a quick thought (or two) on this:
1. Are there any foreign keys pointing to the table? If so, SQL Server doesn't allow truncate against a table that is referenced by FK's.
2. Instead of a semi-colon, have you used the tried and true GO keyword? I realize it's ancient and hokey, but it still works well as far as I know. So the command would look something like 'TRUNCATE TABLE ERR_TIER_BILLING_SUMMARY GO' (without the quotes)
I make no warrantees or guarantees either quick suggestion will work, but it's something I haven't seen written yet.
Bestest!
Bestest!
John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services
"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"
John Miceli
System Specialist, MCP, MCDBA
Berkley Technology Services
"Good Morning. This is God. I will be handling all your problems today. I will not need your help. So have a great day!"