July 16, 2014 at 3:11 am
Hi, i would appreciate suggest the SQL sentence, thanks
CREATE TABLE [dbo].[instructions](
[site_no] [int] NOT NULL,
[instructions] [text] NULL
)
Select top 3 * from instructions
Output
Site_no Instructions
20 Request PIN#510 then proceed
21 Request PIN#987 if wrong request name
22 Request PIN#688 allowed to use only numbers
All text instructions start with “Request PIN#XXX” also after that the text are different for every site_no
I need insert in all site_no rows and after the “Request PIN#XXX” the text “and codeword” keeping the current rest of text
How can I set e REPLACE CAST sentence using something LIKE PIN%%%%
To get these type of results
site_no instructions
----------- ----------------------------------------------------
20 Request PIN#510 and codeword then proceed
21 Request PIN#987 and codeword if wrong request name
22 Request PIN#688 and codeword allowed to use only numbers
Can you please suggest the right update SQL sentence? Beforehand thank you
July 16, 2014 at 3:13 am
Take a look at the STUFF function.
Need an answer? No, you need a question
My blog at https://sqlkover.com.
MCSE Business Intelligence - Microsoft Data Platform MVP
July 16, 2014 at 8:47 am
Additional to that, you should really change your text columns into varchar(max) or even a normal varchar. The text datatype has been deprecated and will be removed in a future version. Additional to that, it's really a PITA to work with that datatype.
Other than that, the STUFF() function and probably CHARINDEX() will do the trick. 😉
July 17, 2014 at 1:07 am
Thanks Koen
July 17, 2014 at 1:07 am
Gracias Luis
Viewing 5 posts - 1 through 4 (of 4 total)
You must be logged in to reply to this topic. Login to reply