Re: Auto truncate a string to be inserted to SQL table

From: Hugo Kornelis (hugo_at_pe_NO_rFact.in_SPAM_fo)
Date: 01/17/05


Date: Mon, 17 Jan 2005 16:57:42 +0100

On Mon, 17 Jan 2005 02:09:07 -0800, BTLye wrote:

>Sorry for the ambiguity...
>
>Actually what I want to do is truncate the string using any method at MSSQL
>server so that the INSERT action will not prompt me for any error.
>
>There is an application written by somebody else previously and being
>deployed to lot of client PCs. The app will insert record to SQL table at the
>end of the processing. I understand that it's faster to add the control
>(truncate the string) at the app. But making this will require all the client
>PCs to deploy the enhanced app again whereby in my case is not accepted by
>the users.
>
>So I wish to look for any alternative to do it at SQL server. The record
>should be inserted into the table by auto truncating any string which exceeds
>the max length being allowed by the table without giving any error. This is
>because for any error that prompts, the app will terminate and no record will
>be inserted.
>
>Hope that I've made my condition clear. Thanks for the guide so far :)

Hi BTLye,

At the risk of pointing out the obvious....

Have you considered changing the table design, so that the table accept
the longest strings the client application can possibly send? That would
solve the problem without the need to change the client application.

Best, Hugo

-- 
(Remove _NO_ and _SPAM_ to get my e-mail address)


Relevant Pages

  • Re: Auto truncate a string to be inserted to SQL table
    ... > Actually what I want to do is truncate the string using any method at MSSQL ... The app will insert record to SQL table at the ... If you are calling a SProc from the application, and passing params, ...
    (microsoft.public.sqlserver.programming)
  • RE: Auto truncate a string to be inserted to SQL table
    ... I agree with Tibor that turning the warnings off will suffice, but, and this ... > Actually what I want to do is truncate the string using any method at MSSQL ... The app will insert record to SQL table at the ...
    (microsoft.public.sqlserver.programming)
  • Re: Unpack When? Part II
    ... If you have the capability to utilize a pick item in the client ... don't need to keep it all in local program memory which makes app design ... be NO improvement in string handling in browsers as, generally, most apps ... So I wonder if this would make a difference as to when to unpack? ...
    (comp.databases.pick)
  • RE: Auto truncate a string to be inserted to SQL table
    ... Actually what I want to do is truncate the string using any method at MSSQL ... The app will insert record to SQL table at the ... So I wish to look for any alternative to do it at SQL server. ...
    (microsoft.public.sqlserver.programming)
  • Re: Unpack When? Part II
    ... The dumber your client is the easier it is to sew other ... which makes app design simpler. ... a fall-off-the-cliff response to adding a string at the end of a previous ...
    (comp.databases.pick)

Loading