Questions tagged [truncate]

Data truncation is the automatic or deliberate shortening of data. A string, decimal number, or datestamp can be truncated to a shorter value. A data stream (such as a file or record set) can be truncated when either the entirety of the data is not needed or when it will be stored in a location too short to hold its entire length. No rounding occurs when numbers are truncated.

Data truncation may occur automatically, such as when a long string is written to a smaller buffer, or deliberately, when only a portion of the data is wanted. The truncation principles can be used in several different ways.

###Function Calls

Many data handling programs have built in methods or functions to handle truncation. Syntax will vary, but the principles are the same. Examples include:

  • Strings: TRUNC("This is a string.", 12) = This is a st
  • Decimals: TRUNC(3.14159, 2) = 3.14 or floor(3.14159) = 3
  • Dates: TRUNC(#7/4/2017 23:45#) = #7/4/2017 00:00#

###SQL Statement

In SQL, the TRUNCATE TABLE statement removes all rows from a table without invoking any triggered actions. The result of this operation quickly removes all data from a table, typically bypassing a number of integrity enforcing mechanisms. It was officially introduced in the SQL:2008 standard. In the SQL standard TRUNCATE TABLE is defined as a data manipulation language (DML) feature but database vendors often classify it as DDL for their own implementation-specific reasons.

The TRUNCATE TABLE mytable statement is logically (though not physically) equivalent to the DELETE FROM mytable statement (without a WHERE clause).

Datestamp values

Datestamps can be truncated. 2009-02-09 09:41:22 can be truncated, for example, to the:

  • year 2009-01-01 00:00:00
  • month 2009-02-01 00:00:00
  • day 2009-02-09 00:00:00
  • hour 2009-02-09 09:00:00

Related tags

References

Function Calls

SQL Statements

1585 questions
0
votes
1 answer

Flex RadioButton label won't truncate

I have RadioButton, just one singular RadioButton not in a Group or anything like that. I set it's width to 100. I then give it a label which is much longer than 100px. Also, in the Skin for this RadioButton I have the Label just being a subclass of…
user1513171
  • 1,912
  • 6
  • 32
  • 54
0
votes
2 answers

Ruby: truncating a long string contained in another string

Let string_a = "I'm a string but this aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa is long." How is it possible to detect the aaaa...aaa (the part without spaces that is very long) part and truncate it so that the result looks like (the rest of the string should…
Alex
  • 2,036
  • 4
  • 22
  • 31
0
votes
1 answer

Truncating Text based on combined characters of two variables

I am using a custom function to truncate text based on an argument which states the number of allowed characters. Here is my code: function bm_best_excerpt($length, $ellipsis, $content) { $text = $content; $text = strip_tags($text); $text =…
JCHASE11
  • 3,901
  • 19
  • 69
  • 132
0
votes
1 answer

How do I prevent PowerCharts from truncating axis labels?

In the Flash version of PowerCharts' ErrorLine chart, the rightmost X axis label is clipped if there are too many categories in the chart. Is there a way to stop PowerCharts from clipping the rightmost X axis label, or is this a bug in…
Michael Calvin
  • 117
  • 1
  • 2
  • 8
0
votes
1 answer

expression engine / truncation - remove anything inside a
 tag

I'm using an expression engine field to post code samples using a
 element and [code] markup, but I'm also using this field as an excerpt. In the excerpt, I want to remove anything inside these pre elements (or stop, somehow, once it reaches…
mheavers
  • 29,530
  • 58
  • 194
  • 315
0
votes
1 answer

Text data getting cut off when returned from DB

When I use MSSQL in php to read a field that has veru long content, I get an error Warning: mssql_query() [function.mssql-query]: Unicode data in a Unicode-only collation or ntext data cannot be sent to clients using DB-Library (such as ISQL) or…
Ian Hsieh
  • 85
  • 3
  • 8
0
votes
1 answer

Jquery: Truncate element content using .substring

I'm trying to use jQuery to take the content of an element, truncate it by character length, then display the output in a new element. I've looked at a number of similar forum posts but can't get anything to work! What am I doing wrong here? (this…
CaribouCode
  • 13,998
  • 28
  • 102
  • 174
0
votes
1 answer

Redirect a URL by inserting index.php in between and truncate the url after a string in the redirect url

I have recently ported my blog from one cms to wordpress so I was having trouble in redirect the tag URL which are like this http://site.com/blog/tag/tagname/foobar Here "tagname" is the name of tag created using WordPress and "foobar" can be any…
Shivam Mathur
  • 2,543
  • 19
  • 26
0
votes
2 answers

Using JList to save tabledata to database via JDBC

First off id like to note that this works when there is 1 row of information but not when there is many for some reason... which is what my question is about... As the code is decently long i will post it in pieces: int count =…
NeedyHelpo
  • 13
  • 6
0
votes
0 answers

PHP How to truncate array?

Possible Duplicate: PHP how to truncate an array I have an array which displays text from a MySQL table. I want to truncate the data to a certain length (undecided) and add "... Read more" at the end of the truncation. Here is the code block…
0
votes
1 answer

Change size of files on Windows machine from remote Linux machine

I need to change somehow size of files (increase or decrease) on Windows machine using bash scripts. (Content of files doesnt matter) But i have to run this scripts from remote linux machine. I've selected truncate command for size changing, this is…
Bohdan Sukhov
  • 212
  • 2
  • 5
0
votes
1 answer

How do I "run" a command in a stored procedure thats generated from a select statement?

I am using this script https://stackoverflow.com/a/9452317/449156 to generate statements to drop and re-create all my foreign key constraints so I can truncate specific database tables. This works excellently, however I am wondering how I can…
BlueChippy
  • 5,935
  • 16
  • 81
  • 131
0
votes
2 answers

Format String to truncate a number to a specific number of digits

Is there a format string to truncate a number to a specific number of digits? For example, any number greater than 5 digits i would like to truncate to 3 digits. 132456 -> 132 5000000 -> 500 @Erik : Format specifiers like %2d are specific to a…
user930514
  • 917
  • 2
  • 16
  • 28
0
votes
2 answers

Dynamically make a child container take available width inside variable width parent

I have a container which wraps around three floated containers, the wrapping container has a variable width and the left most inner container has a width of 100px and the right most inner container has a width of 500px. The center container does not…
user888750
0
votes
0 answers

Truncating transcation log file in SQL server 2008 for a database in replication

We have a large SQL server 2008 database (full recovery mode) replicated to another server using transactional replication. The transactions log file is growing due to the amount of transactions we have. The current size is about 300 GB. I tried to…
PyQL
  • 1,830
  • 3
  • 18
  • 22
1 2 3
99
100