• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 315
  • Last Modified:

substring

pls help. i need to update a table where 2 fields were made larger.  the select statement like this seems to work

select substring(macro1,1,71)+'       '+
substring(macro1,72,2000).

i want to update substring(macro1,1,71) to substring(macro1,1,71)+'       '+

please help.  Thank you.
0
poporon5
Asked:
poporon5
1 Solution
 
Aneesh RetnakaranDatabase AdministratorCommented:
update tableName
set macro1 = substring(macro1,1,71)+'       '+substring(macro1,72,2000)
0
 
AnujCommented:
Update TableName
SET ColumName = substring(ColumName ,1,71)+'       '+substring(ColumName ,72,2000).
0
 
ThomasianCommented:
You can use STUFF instead of SUBSTRING
SELECT STUFF(macro1,72,0,'       ')

Open in new window

Test the SELECT query first before updating
UPDATE tablename 
SET macro1 = STUFF(macro1,72,0,'       ')

Open in new window

0

Featured Post

NFR key for Veeam Agent for Linux

Veeam is happy to provide a free NFR license for one year.  It allows for the non‑production use and valid for five workstations and two servers. Veeam Agent for Linux is a simple backup tool for your Linux installations, both on‑premises and in the public cloud.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now