Global Find And Replace Utility For SQL

Jun 11, 2004

Howdy all,

I am looking for a good global find and replace utility for SQL Svr. I have tried the Speed Ferret demo which seemed to work well but did not address code outside of the databases such as DTS. Does anybody know of a utility that can go beyond databases?

Thanks

View 3 Replies


ADVERTISEMENT

Global Stored Proc Find And Replace

Jan 29, 2004

Hello all,
Being a relative newbie to large scale MSSQL development, I'd like to try and find out if there is some sort of utility, command or stored proc that I can use to globally change all text within my database's stored procedures.

For example... I would like to change a table name from dbo.xtable... to dbo.ytable... Is this possible?

Actually, I'd be happy with some way to search through all my stored procs to find a specific string (i.e. xtable in the example above).

Any help provided will be greatly appreciated!

Jordan Stradtman

View 7 Replies View Related

Can't Find CSV-file After Using BCP-utility In Stored Procedure

Jan 19, 2008

Hello peopleI have an issue with the Bulk Copy Program-utility.When I execute the BCP in the commandline, it will create a CSV-file.Code in commandline:




Code Block

bcp.exe PCVO.dbo.tblOpleidingen out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -Sservername
Code in stored procedure:




Code Block

USE [PCVO]
GO
/****** Object: StoredProcedure [dbo].[sp_ExportAccessToCSV] Script Date: 01/19/2008 16:36:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[sp_ExportAccessToCSV]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

DECLARE @sql varchar(8000)

SET @sql = 'bcp.exe PCVO.dbo.tblOpleidingen
out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -S' + @@servername

EXEC xp_cmdshell @sql

END
Code in C#-application:



Code Block

String connectionString = "Data Source=THUIS-LENNY\SQLEXPRESS;Initial Catalog=PCVO; Integrated Security=True";

System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connectionString);
con.Open();

System.Data.SqlClient.SqlCommand da = new System.Data.SqlClient.SqlCommand("sp_ExportAccessToCSV", con);
da.CommandType = CommandType.StoredProcedure;
da.ExecuteNonQuery();
When I use the BCP-utility inside a stored procedure (called in a C#-application),using the xp-cmdshell, I can't find the created file. I even don't get an error or warning message.Can somebody help me?Thanks in advance,G VossiusNB: I'm using SQL Server 2005, Visual Studio 2008 C# EE

View 1 Replies View Related

Can't Find CSV-file After Using BCP-Utility In Stored Procedure

Jan 19, 2008

Hello people
I have an issue with the Bulk Copy Program-utility.
When I execute the BCP in the commandline, it will create a CSV-file.

Code in commandline:



Code Blockbcp.exe PCVO.dbo.tblOpleidingen out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -Sservername






Code in stored procedure:



Code Block
USE [PCVO]
GO
/****** Object: StoredProcedure [dbo].[sp_ExportAccessToCSV] Script Date: 01/19/2008 16:36:20 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[sp_ExportAccessToCSV]
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
DECLARE @sql varchar(8000)
SET @sql = 'bcp.exe PCVO.dbo.tblOpleidingen
out "C:planning.csv" -c -t";", -eE:Rakoerror.log -Uxx -Pxx -S' + @@servername

EXEC xp_cmdshell @sql

END






Code in C#-application:



Code Block
String connectionString = "Data Source=THUIS-LENNY\SQLEXPRESS;Initial Catalog=PCVO; Integrated Security=True";
System.Data.SqlClient.SqlConnection con = new System.Data.SqlClient.SqlConnection(connectionString);
con.Open();
System.Data.SqlClient.SqlCommand da = new System.Data.SqlClient.SqlCommand("sp_ExportAccessToCSV", con);
da.CommandType = CommandType.StoredProcedure;
da.ExecuteNonQuery();





When I use the BCP-utility inside a stored procedure (called in a C#-application),
using the xp-cmdshell, I can't find the created file. I even don't get an error or warning message.
Can somebody help me?
Thanks in advance,

G Vossius

NB: I'm using SQL Server 2005, Visual Studio 2008 C# EE

View 4 Replies View Related

Find Templates For Global Or System Functions And Sp In 05

Jul 28, 2006

In 2000 you could look at templates and find templates for global or system functions where are they in 05?

View 1 Replies View Related

Find And Replace

Sep 13, 2006

To ensure I don't leave orphans floating around in tables when records get deleted (values from one record might link to values in another) how do I find and possibly replace values in tables?For example, if I have a unit of measure table and want to delete the value "inches", how do I look in other tables to find this value and give the user the option to cancel or clear it out. If I don't it will cause controls bound to that value like the dropdownlist to throw an error.

View 1 Replies View Related

Find And Replace.

Apr 30, 2004

Does anybody know how to search through all stored procedures (in SQL Server 2000) and find and replace text without having to open each one individually in Query Analyzer and doing so one at a time?

That would be so time consuming. I want to be able to change my table names, but I have so many stored procedures allready using the old names. To go and find each name and replacing them is a task I don't want to even try and do.

Thank you to whomever can help.

Alec

View 1 Replies View Related

Find And Replace......EVERYTHING?!

Jan 4, 2007

Hi I run a find and replace in my script to replace some key words.

Little did I know that in SQL Server 2005 that it actually finds and replaces ALL query windows open for that database.

Any ideas on how I can turn this setting off? so that it only finds/replaces within the query window that I am using.

Thanks in Advance!

View 1 Replies View Related

Find Replace?

Jan 9, 2008

Hello,

Wondering if anyone may have any advice on how to do this?

I need to do Find/Replace of text in a varchar field so that it looks for text I want then it replaces that text with the new text and updates the field with that specific change, leaving everything else intact.

And I need to do this for every row in a table.

Thanks in advance!!

--PhB

View 3 Replies View Related

Find And Replace

Jan 23, 2008

Hello All,
I have a master file with

Slcode Sldesc
S0001 Furniture & Fittings
S0002 Investments
S0003 Coolie & Cartage

I want to find the ampersand character in between and replace with and.

Nirene

View 4 Replies View Related

Find And Replace Syntax

May 10, 2001

Is there a way (using a combination of "stuff" and patindex")
to do the following:

replace this --> 1 2 3 4 5
with this --> 12345
or better yet --> 1,2,3,4,5

note: these "spaces" are tab delimited!

any help would be appreciated!
TB

View 1 Replies View Related

Updating - Find And Replace

May 30, 2007

Basically I want to do a find and replace.
All the rows where column1 starts with F: I want to replace with M:
I tried this without luck

update table
set left(column1,1)='M'
where
left(column1,1)='F'

thanks

View 5 Replies View Related

Find And Replace Values

Dec 7, 2007

I was wondering how to do a find and replace with SQL? Would I use a SET statement?

I need to find a specific value and replace all of the results with a different value.

Thanks for all responses.

View 1 Replies View Related

Find And Replace Table Name

Feb 21, 2008



Hi

acutally due to certain reason i have changed the few tables name in my database, but now i m facing problem in my software, i have alot of procedures and function as well in my database and these are using old table name,
Is there any script that i can use to replace the name of the tables.
i have checked few procedure/function in which i use table name with different style like [dbo].[tablename] and in some places i just use only [tablename].

Can anyone help me ?


Thanks and looking forward.

View 4 Replies View Related

Find/Replace ColumnNames In All SPs/Views

Feb 25, 2001

I would like to change a column name, but before doing so would like to search all SPs and Views for occurrences of that name. I would be happy with just a list of them, but even cooler would be the ability to change all the occurrences to the new name.

Thanks!
Arthur

View 1 Replies View Related

How To Find And Replace In Entire Database

Nov 21, 2013

I have to replace gl_number 25050-80 with gl_number 25050-80 in the entire database. I know how to do that in a table but not in all tables.

View 2 Replies View Related

Find And Replace String Manipulation Help

Mar 14, 2008

Please help me with the sql script to manipulate the string data:

I need to add <Text> at the beginning and end of the string.
I also need to add <option> before the first and after last occurence of the <Option> string. The original string

<StockNumber>502</StockNumber>
<OptionKey>113</OptionKey>
<OptionKey>151</OptionKey>
<Warranty>1</Warranty>

should look like

<Text>
<StockNumber>502</StockNumber>
<Option>
<OptionKey>113</OptionKey>
<OptionKey>151</OptionKey>
<Option>
<Warranty>1</Warranty>
<Text>


Thanks.

View 6 Replies View Related

Pattern Matching Or Find And Replace In SQL Query

Oct 29, 2007

I have a table called MessageBoard.  It has a column called Messages.
A user can type text including any html tags through a text area ans when he saves it by clicking a button, the content typed by the user is saved in the MessageBoard Table (in the Messages) column.  So once saved, the html tags are kept intact.  If I have to find and replace certain html tags, what kind of SQL Query I have to write?
For example I want to find all the <pre> </pre> tags and replace it with <p> </p> tags.  How do I do this?

View 6 Replies View Related

T-SQL (SS2K8) :: Enhanced Find And Replace Function

Apr 17, 2014

I'm looking for a way to pull off a complex find+replace within some code, as follows:

@step_name = N'SAME - OCF Collins (Tabard)', @command = N'DTSRun /~Z0x5F4F7B0688825E7544AC46CFD664F98AC ', @database_name = N'

We have over 200 variants of the above, but following the same syntax (@step_name, Dbname, @Command etc...

Rules:

1) Note the unique identifier "~Z0x5F4F7B0688825E7544AC46CFD664F98AC". I would like it replaced for whatever is between "@step_name = N'" , and @command = N'DTSRun ; (this will form a filename).

2) Note the 'DTSRun /' string. I'd like that replaced with Dtexec /F "D:MyFileLocationFolderHere" (this folder remains constant).

View 2 Replies View Related

Find All Special Characters And Replace With Space?

Feb 7, 2014

i need to find and all special characters and replace with space.

Following query works well for me to finding all rows having special char.

SELECT DESC FROM TBL_DESC
WHERE DESC LIKE '%[^A-Z0-9 ]%'

replacing special char with space . i need to remove special chars only.

View 3 Replies View Related

Find And Replace Carriage Return Character

May 30, 2007

Hi I have a text file which I need to import into Access or SQL.

It is 500,000 records which is pipe delimited. The problem is, is that it can contain carriage returns: (square symbol).

Therefore I need to find and replace these characters

Does anybody know of any free ware text file viewers that can do this??

Best Regareds

David

View 3 Replies View Related

Transact SQL :: Find / Replace Numbers In Server

Aug 12, 2015

I have a separate list of calendar years with radiocarbon year equivalents in SQL server but no conversion equation. Most but not all of the data I have is in radiocarbon years. I thought at first I could just link the tables but I don't want the data that is already in calendar years to be linked to this conversion table. Is there any way I can either link the two tables with criteria for which data is linked (Only ages that are in radiocarbon years). Or possibly a way to query all ages that are in radiocarbon years and do something similar to a find and replace with a large list of numbers to change?

View 14 Replies View Related

T-SQL (SS2K8) :: Find And Replace Text For All Sprocs On A Server

Apr 24, 2014

There are plenty of scripts to do this on a per-DB level, but any that will allow me to generate a script for all DB's at once? Mine are split across dozens and it would be much easier to do a loop (using MS_ForeachDB ? )

View 1 Replies View Related

Transact SQL :: Using Regular Expression To Find And Replace Data

Sep 9, 2015

I am writing an SQL query to find an replace data in a column. I have a table that is filled with

C:usersXXXXappdata
C:usersYYYYappda
C:usersZZZZZZappdata

I would like to replace the c:usersXXXXX part with %userprofile%

The end result would be %userprofile%appdata

I know how to dot the replacement in powershell. it's quite easy

-replace "c:users[^]+","%userprofile%"  

Basically how would transfer this into SQL...

View 10 Replies View Related

SQL Server 2012 :: Find A Specific String And Replace It With Another Inside Of VARCHAR Field

Aug 14, 2015

I'm trying to find a specific string (a name) and replace it with another inside of a VARCHAR(7000) field. Unfortunately, there are names like Ted and Ken that I'm trying to replace. I would like to leave words like Broken, admitted, etc... intact.

UPDATEtbl
SETBody = LEFT(REPLACE(tbl.Body, pm.OldFirstName, p.FirstName), 7000)
FROM Table tbl
JOIN Person p ON p.PersonID = tbl.PersonID
JOIN PersonMap pm ON pm.PersonID = p.PersonID AND LEN(pm.OldFirstName) > 2
WHEREtbl.Body LIKE '%[^a-z]'+pm.OldFirstName+'[., ]%

'The problem I'm running into is that the '[, ]%' in the LIKE excludes any record that ends with the FirstName because it is requiring either a space, comma or period after the name. Is there some way to add an empty string to the list of acceptable characters as that would cover any scenario in the data? I would prefer not to add all characters except space, comma and period, but I guess I could do that.

View 5 Replies View Related

SQL Server 2014 :: Find String With Spaces And Replace Them With Other String

Sep 8, 2015

I have following query which return me SP/Views and Functions script using:

select DEFINITION FROM .SYS.SQL_MODULESNow, the result looks like
Create proc
create procedure
create proc
create view
create function

I need its result as:

Alter Procedure
Alter Procedure
Alter Procedure
Alter View
Alter Function

I used following

select replace(replace(replace(DEFINITION,'CREATE PROCEDURE','Alter Procedure'), 'create proc','Alter Procedure'),'create view','Alter View') FROM .SYS.SQL_MODULESto but it is checking fixed space like create<space>proc, how can i check if there are two or more spaces in between create view or create proc or create function, it should replace as i want?

View 5 Replies View Related

Line Of Code For &"find & Replace/delete&"

Jan 14, 2007

I have mysql type db in which I need computer to search for a key phrase of text that has several hundred occurances inside product table descriptions of products on live site. Once it finds the text, I would like for it to simply remove it, and look for the next occurance of the phrase and repeat the process until all are flagged and removed. I was told their may be a line of sql code that employs such a feature. Can anyone tell me what such a line would be?

View 1 Replies View Related

BCP Utility .

Aug 6, 2002

Hello ,

I want to know how can i can use the bcp coomand to import a text file into a SQL database table . The text file contains info. like servername , date , time , logininfo and description .

The problem is i cannot import that file into the table through data import wizard . The wizard is not able to separate the fields properly and the import takes place with mixed up data in different columns . The separator in the text file is colon . I even tried fixed length with manual column separation .
The text in the text file are not aligned properly as these are log files generated by the system which i am trying to import in a table .

So how can use the bcp command to specify the column length properly and seperate the fields uniformly so that the data gets imported neatly .

Any thoughts how could the command look like ?

Thank you very much .
Anita.

View 1 Replies View Related

Bcp Utility

Aug 2, 2001

Hi,
I used bcp utility to import and export data between databases. These exported data is it read only? If so how can I change the parameter so that we could edit as well.
Any suggestions will be helpful. Thank you!

View 1 Replies View Related

Bcp Utility

Oct 8, 2002

I'm trying to use the bcp command to bcp out a single table in a database, what is the best way to do this in the query analyzer? Thanks in advance.

View 1 Replies View Related

BCP Utility

Jul 27, 2004

Hi all,

I want to use the BCP utility to import data from a .dat file into my database. The .dat file contains a table called xv_Appointments containing the following fields:

AppointmentKey
SurgerySlotKey
PatientKey
Cancelled
Continuation
Deleted
TimeArrived

I would like to import only two of these fields into a table called tbl_Appointments e.g.

AppointmentKey
TimeArrived

I can't seem to get the BCP util to do this. It only works if I import all of the fields from xv_Appointments. Does anyone know if this is possible?

Thanks

View 8 Replies View Related

BCP Utility

Jan 20, 2004

In the process of exporting data from SQL data file to text file through BCP utility I am not getting the Column names.How can I get the column names through BCP utility?
I used this script
exec master..xp_cmdShell 'bcp "select * from regulator.dbo.TEMPTBLBRANCHNOTUPLOAD" QueryOUT \indiadbftprootCLIENT_BRANCH_UPLOADranchnotup loaded.csv -S indiadb -U sa -P sasocrates -k -r -c -t "," -q'

View 1 Replies View Related

DTS Utility

Feb 28, 2004

Hello,
I am using the DTS utility available with Enterprise Manager in MSSQL server 2000. I can transfer the tables and views without any issues but when i try to transfer the stored procedures it always gives an error. I have tried transferring individual objects too but it does'nt works. The error given is "the user <username> cannot perform the following action". Any help is appreciated.
Thanks in Advance

View 4 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved