Questions tagged [sql-truncate]

7 questions
150
votes
10 answers

Delete all the records

How to delete all the records in SQL Server 2008?
kaveh
  • 1,509
  • 2
  • 9
  • 3
0
votes
0 answers

How do I only truncate a table in PSQL if only that table exist?

I want to replace drop & create with truncate. So the first step i wand to add is check if the table already exists and truncate it. How do I only truncate a table in PSQL if only that table exist? I want something like TRUNCATE TABLE IF EXISTS…
MNR
  • 1
0
votes
0 answers

Strange issue with SQL SERVER 2016 SP2 VERSION during string insert resulting in error Msg 8152, Level 16, State 31, Line 8

I have SQL server 2016 SP2 version installed with DB compatibility set to 130 . Running a SQL code to do an insert into table variable results in Msg 8152, Level 16, State 31, Line 8 (String or binary data would be truncated.) But when i run the…
0
votes
1 answer

Is it possible capture all records into table A from table B on or after truncating table B

I am trying to write a trigger with reference to Postgres DOC. But its not even allowing to create a trigger base on truncate, tried different approaches but didn't work. CREATE TRIGGER delete_after_test AFTER truncate ON tableA FOR EACH ROW EXECUTE…
SQLLER
  • 29
  • 8
0
votes
2 answers

1062 Duplicate entry '2147483647' for key 'pim_catalog_completeness.PRIMARY'

As a result of frequent execution of pim:completeness:calculate command, we can face the next exception: An exception occurred while executing ' INSERT INTO pim_catalog_completeness (locale_id, channel_id, product_id, missing_count, required_count)…
igormukhingmailcom
  • 465
  • 1
  • 6
  • 9
0
votes
1 answer

Syntax error at or near "TRUNCATE" - Aurora Postgres 10.12

I am trying to refactor a query and remove a set of window function to instead capture all records as is. When I go to paste query in to replace my function, pgAdmin indicates a syntax error near the 'Truncate' statement. I just cant figure out what…
-1
votes
1 answer

Resolving "String or binary data would be truncated" error when provided line is inaccurate

I am running SQL Server 2017 using SQL Server Management Studio. The details I can give about my error are that it reads as follows: Failed to load data into -- Database due to : String or binary data would be truncated. :Procedure ~~ : Line # The…