Showing posts with label truncate. Show all posts
Showing posts with label truncate. Show all posts

Tuesday, March 27, 2012

Clear all the tables of a database

Is there a simple method to clear all the tables in a db or to make a copy of the mdf file without the datas ?

I tried to use TRUNCATE TABLE but it doesn't work with foreign keys ?

Thanks.

You probably will have to write your own script for this to reflect the dependencies. As you already stated, Truncate won′t work with foreign keys and an undocumented procedure like sp_msforeachtable won′t care about the order to process.

HTH, Jens K. Suessmeyer.

http://www.sqlserver2005.de

Tuesday, March 20, 2012

Chunked Delete?

I can't truncate a table because I'd lose the Identity columns that
are referenced in other tables, but I do need to delete all 2 million
rows in there.
Is there a way to recusrively delete rows in say 1,000-row chunks to
keep the transactions small and DB load lighter?
Thanks.See if this thread helps:
http://groups-beta.google.com/group...
a0488274c6e93
--
HTH,
Vyas, MVP (SQL Server)
SQL Server Articles and Code Samples @. http://vyaskn.tripod.com/
"xenophon" <xenophon@.online.nospam> wrote in message
news:8qhga11qephoebnh1afec88usol8rulg44@.
4ax.com...
I can't truncate a table because I'd lose the Identity columns that
are referenced in other tables, but I do need to delete all 2 million
rows in there.
Is there a way to recusrively delete rows in say 1,000-row chunks to
keep the transactions small and DB load lighter?
Thanks.sqlsql

Sunday, February 19, 2012

checking length of textbox value!

Hi

I was looking to check the length of a textbox then truncate it if it is graeter than some value and assign the that value for a textbox control in reporting service.How can i acheve this?

Thanks

This expression truncates any string in the textbox longer than 2 characters.

=Iif(Fields!FieldName.Value.ToString().Length() > 2, Fields!FieldName.Value.ToString().Substring(0,2), Fields!FieldName.Value)

You will need to change the field name to the actual field going into the textbox.

|||

I do not know who you are but I really would like to appreciate you !

Thanks a lot!

Ephi.

|||

I want to do the same thing as well as if the length of the field is shorted than the required length, I need to pad it with spaces. Can someone help with how to do that as well ?

Thanks

AY

checking length of textbox value!

Hi

I was looking to check the length of a textbox then truncate it if it is graeter than some value and assign the that value for a textbox control in reporting service.How can i acheve this?

Thanks

This expression truncates any string in the textbox longer than 2 characters.

=Iif(Fields!FieldName.Value.ToString().Length() > 2, Fields!FieldName.Value.ToString().Substring(0,2), Fields!FieldName.Value)

You will need to change the field name to the actual field going into the textbox.

|||

I do not know who you are but I really would like to appreciate you !

Thanks a lot!

Ephi.

|||

I want to do the same thing as well as if the length of the field is shorted than the required length, I need to pad it with spaces. Can someone help with how to do that as well ?

Thanks

AY