1

Topic: Whether it is possible to change the content of many scripts in a database?

There is a table in which scripts for an output of reports in FastReport are stored and in them for an age output is used "datediff (dd, birthdate, getdate ())/365.25". In this connection at some people the age settles up inaccurately.
These scripts are stored in the table in normal varchar (max) a format, and them there under 300 pieces. Whether it is possible  all available scripts, replacing there this line, with for example such:
"(datediff (year, birthdate, getdate ()) -
case
when month (birthdate) <month (getdate ())
then 0
when month (birthdate)> month (getdate ())
then 1
when day (birthdate)> day (getdate ())
then 1
else 0
end)"
Such function the age settles up precisely, to the day.

2

Re: Whether it is possible to change the content of many scripts in a database?

Easier manually to change all scripts a lot of time demands.

3

Re: Whether it is possible to change the content of many scripts in a database?

Whether

kombala wrote:

It is possible  all available scripts

the Question in what, whether it is possible to make  fields of type a line in the table? Yes, it is possible. REPLACE.

4

Re: Whether it is possible to change the content of many scripts in a database?

For types text, varchar (max) is UPDATETEXT and UPDATE column.writetext accordingly. Read help about these types.

5

Re: Whether it is possible to change the content of many scripts in a database?

Kolosov wrote:

For types text, varchar (max) is UPDATETEXT and UPDATE column.writetext accordingly

https://docs.microsoft.com/en-us/sql/t-sql/queries/writetext-transact-sql wrote:

Permits minimally logged, interactive updating of an existing text, ntext, or image column. WRITETEXT overwrites any existing data in the column it affects.
...
Use WRITETEXT to replace text, ntext, and image data and UPDATETEXT to modify text, ntext, and image data. UPDATETEXT is more flexible because it changes only a part of a text, ntext, or image column instead of the whole column.

6

Re: Whether it is possible to change the content of many scripts in a database?

Kolosov wrote:

For types text, varchar (max) is UPDATETEXT and UPDATE column.writetext accordingly. Read help about these types.

kombala wrote:

These scripts are stored in the table in normal varchar (max) a format

7

Re: Whether it is possible to change the content of many scripts in a database?

alexeyvg;
Well it is finite, update replace, thanks big, itself did not guess that so it is possible to make, replace all few times used in .

8

Re: Whether it is possible to change the content of many scripts in a database?

On a subject: It is possible to try to replace with SQL-function.

9

Re: Whether it is possible to change the content of many scripts in a database?

iap wrote:

it is passed...
it is passed...

You only read half from this that I wrote.

10

Re: Whether it is possible to change the content of many scripts in a database?

Kolosov wrote:

it is passed...
You only read half from this that I wrote.

It even quoted completely.
Archaic methods of operation with archaic types are resulted;
+ Appeal to read help about them.
Though something can there still invisible ink is written, certainly

11

Re: Whether it is possible to change the content of many scripts in a database?

o-o;
You too did not read up.
varchar (max)
UPDATE column.writetext
UPDATE (Transact-SQL)
column_name {.WRITE (expression, @Offset, @Length)
For partial or a regeneration of data types varchar (max), nvarchar (max) and varbinary (max) the sentence.WRITE (expression, @Offset, @Length) is used.

12

Re: Whether it is possible to change the content of many scripts in a database?

Kolosov wrote:

you too did not read up.

you already some times hinted, tell directly, and that like can understand nobody (I precisely).
What for the HARDWARE it is necessary WRITE?