| Author |
Topic |
|
jsinks
Starting Member
13 Posts |
Posted - 2007-03-20 : 03:41:26
|
| hi;i want to write a script to delete search for a string in a paragraph, if found it should be deleted.will appreciate any help |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-20 : 03:50:31
|
[code]declare @str nvarchar(4000), @del nvarchar(100)select @str = 'hi;i want to write a script to delete search for a string in a paragraph, if found it should be deleted.will appreciate any help'select @del = 'delete'select @str = replace(@str, @del, '')print @str/* hi;i want to write a script to search for a string in a paragraph, if found it should be d.will appreciate any help*/[/code] KH |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-03-20 : 04:14:56
|
| This is a forum for posting working queries.Questions should be asked in proper forum.Peter LarssonHelsingborg, Sweden |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-20 : 04:24:29
|
Oh did not notice that. Hereafter avoid this (c) madhi KH |
 |
|
|
jsinks
Starting Member
13 Posts |
Posted - 2007-03-20 : 05:47:55
|
| hey, thanks Khtan. I am sure this will help, I want to use the script you have just shown me to delete the string 'SQLSTATE 01000' from a stored procedure called Print_test which when executed from sql server argent, its output is "I want to omit [SQLSTATE 01000]"The expected output should be "I want to omit".i will inform you if i manage. you can tell me if you have a solution while am trying.Thanks |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-03-20 : 08:05:04
|
[code]declare @str varchar(100)select @str = 'I want to omit [SQLSTATE 01000]'select replace(@str, '[SQLSTATE 01000]', '')[/code] KH |
 |
|
|
jsinks
Starting Member
13 Posts |
Posted - 2007-03-21 : 07:17:46
|
| Thank you |
 |
|
|
X002548
Not Just a Number
15586 Posts |
|
|
jsinks
Starting Member
13 Posts |
Posted - 2007-05-07 : 03:19:41
|
| Hi, Khtan.You solution has been so heplful, i have been using it in many instances. however each time i use replace, i am having lines above the printed output.plz help!! |
 |
|
|
khtan
In (Som, Ni, Yak)
17689 Posts |
Posted - 2007-05-07 : 08:42:21
|
what do you mean " lines above the printed output" KH |
 |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-07 : 08:46:28
|
| I believe he means column headers...jsinks,If you want to turn the column headers (and lines) off, goto Tools, Options, Results and uncheck option "Print Column Headers".Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
|
jsinks
Starting Member
13 Posts |
Posted - 2007-05-10 : 05:18:18
|
| Thank you but the job is in SQL Server Agent not in Query analyser. |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-10 : 08:40:38
|
| Topic moved from script library._______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2007-05-10 : 08:48:35
|
First action as moderator, huh? Peter LarssonHelsingborg, Sweden |
 |
|
|
spirit1
Cybernetic Yak Master
11752 Posts |
Posted - 2007-05-10 : 09:00:35
|
yup. just getting the hang of it _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
Posted - 2007-05-10 : 09:40:08
|
quote: Originally posted by spirit1 yup. just getting the hang of it _______________________________________________Causing trouble since 1980blog: http://weblogs.sqlteam.com/mladenp
Keep it up MadhivananFailing to plan is Planning to fail |
 |
|
|
|