truncate

Delete, Truncate or Drop MySQL question

Hi Everyone! I am attempting to clean out a table but not get rid of the actual structure of the table, i have the following columns: id, username, date, text the id is auto incrementing, I don't need to keep the ID number, but i do need it to keep its auto-incrementing characteristic. I've found delete and truncate but I'm worried one...

Truncate a HTML formatted text with SMARTY.

Hi there! I've got a variable which is formatted with random HTML code. I call it to {$text} and i truncate it. The value is for example: <div>Lorem <i>ipsum <b>dolor <span>sit </span>amet</b>, con</i> elit.</div> If i truncate the text's first ~30 letters, I'll get this: <div>Lorem <i>ipsum <b>dolor <span>sit The problem is, I ...

Merging two Regular Expressions to Truncate Words in Strings

I'm trying to come up with the following function that truncates string to whole words (if possible, otherwise it should truncate to chars): function Text_Truncate($string, $limit, $more = '...') { $string = trim(html_entity_decode($string, ENT_QUOTES, 'UTF-8')); if (strlen(utf8_decode($string)) > $limit) { $string ...

How to get last 12 digits from a string in MySQL?

Hello. How would I get last 12 digits of a string using mysql? Let's say I have a varchar field with a tracking number, that may be anywhere from 5 to 20 varchars long. But I only need to select last 12 digits or less if there are less. so in a field = 12345678123456789012 I would only need to get what's in brackets field = 1234567...

drop/truncate and rollback segment

I know that drop removes the data as well as the table structure whereas truncate retains table structure. Does drop/truncate write to roll back segment ? ...

Ruby on Rails Truncate text - can I use it for a combination of title and content?

I have <%=link_to topic.title, topic_path(topic) %> - <%= truncate(topic.description_without_embed, :length=>50, :omission =>"...") %> But what I really want to do is to truncate both the title and the post to 50 characters. How can this be done? The output should look something like Lorem ipsum dolor sit amet, consectetur adipisci...

How do I truncate a .NET string?

I apologize for such a question that likely has a trivial solution, but strangely, I could not find a concise API for this problem. Essentially, I would like to truncate a string such that its length is not longer than a given value. I am writing to a database table and want to ensure that the values I write meet the constraint of the ...

Truncate all tables in postgres database

I regularly need to delete all the data from my postgresql database before a rebuild. How would I do this directly in SQL? At the moment I've managed to come up with a SQL statement that returns all the commands I need to execute: SELECT 'TRUNCATE TABLE ' || tablename || ';' FROM pg_tables WHERE tableowner='MYUSER'; but I cant see ...

When using truncate I get the following error "index 113257 out of string"

What does this error mean? Here is the line of code that generates it apts[ndex] = truncate(results[ndex][:public_note].to_s,:length => 300) results is an array of activerecord objects ...

Shrinking or partially truncating a file in DOS/FAT

I've been tasked with writing a data collection program for a Unitech HT630, which runs a proprietary DOS operating system that can run executables compiled for 16-bit MS DOS with some restrictions. I'm using the Digital Mars C/C++ compiler, which is working well thus far. One of the application requirements is that the data file must...

Truncating table does not make the mysql file smaller

I truncated several huge tables, but the mysql file and database appears to remain at the same size. Does truncate table delete the data from mysql as well? ...

Truncate the underlying table in a view

I'm currently in a situation where we are creating a "facade" database which basically consists of a set of views which are simply a select from an identically named table in another database. The idea is that the application can be repointed to the facade database with minimal changes to the actual code. This seems to work ok for inser...

How to truncate a table with Spring JdbcTemplate?

I'm trying to truncate a table with Spring: jdbcTemplate.execute("TRUNCATE TABLE " + table); Get the error: Caused by: org.springframework.jdbc.BadSqlGrammarException: StatementCallback; bad SQL grammar [TRUNCATE TABLE RESULT_ACCOUNT]; nested exception is java.sql.SQLException: Unexpected token: TRUNCATE in statement ...

Truncate C++ string fields generated by ostringstream, iomanip:setw

In C++ I need string representations of integers with leading zeroes, where the representation has 8 digits and no more than 8 digits, truncating digits on the right side if necessary. I thought I could do this using just ostringstream and iomanip.setw(), like this: int num_1 = 3000; ostringstream out_target; out_target << setw(8) << ...

Alright to truncate database tables when also using Hibernate?

Is it OK to truncate tables while at the same time using Hibernate to insert data? We parse a big XML file with many relationships into Hibernate POJO's and persist to the DB. We are now planning on purging existing data at certain points in time by truncating the tables. Is this OK? It seems to work fine. We don't use Hibernate's s...

Truncate text if it atempts to run into three lines

I have a small <p> about 140px wide aligned next to a picture. In total there is space for four lines of text. The first two lines are reserved for the title and there are two lines of other info. I want the title to be cut if it spans more than two lines else it will push the other info out of line with the bottom of the image. The on...

Jquery add elipse (...) and truncate text based on height not width.

I have found many ways to measure width and to truncate text using jquery, but I can't find one based on height. I am limited to two lines of text or it will knock my design out of canter. So does anyone know a method of limiting a paragraph to two lines high, tuncating it and adding an elipse ? ...

How to truncate HTML to certain number of characters?

I have some content (some from an external source, some specially written) that is displayed in a kind of blog format. I want to cut off the text after a certain number of characters, so currently I'm doing this: <?=substr( strip_tags($a['content']), 0, 400 )?> The problem is, this loses all the formatting and I just get one massive b...

SQL Query to truncate table in IBM DB2

Hi, Can any one give me the syntax to truncate a table in IBM DB2. I m running the following command: truncate table tableName immediate; The eror is DB2 SQL Error: SQLCODE=-104, SQLSTATE=42601, SQLERRMC=table;truncate ;JOIN , DRIVER=3.50.152 Message: An unexpected token "table" was found following "truncate ". Expected tokens may in...

How to check if UILabel is truncated?

I have a UILabel that can be varying lengths depending on whether or not my app is running in portrait or landscape mode on an iPhone or iPad. When the text is too long to show on one line and it truncates I want the user to be able to press it and get a popup of the full text. How can I check to see if the UILabel is truncating the te...