显示标签为“modify”的博文。显示所有博文
显示标签为“modify”的博文。显示所有博文

2012年2月16日星期四

any easy way to modify string in dbase

HI I have a database with a string as one of the fields and I need to modify
only a portion of the string. For example below is a record in the database
old string
server1/folder1
want to change to
server2/folder1
Paul G
Software engineer.
REPLACE is one good option. Here is an example:
create table #test111
(scode int,
sdesc varchar(30))
insert into #test111 values (1,'server1/folder1')
insert into #test111 values (2,'server1/folder1')
update #test111 set sdesc = replace(sdesc,'server1/','server2/')
where scode = 1
select * from #test111
"Paul" wrote:

> HI I have a database with a string as one of the fields and I need to modify
> only a portion of the string. For example below is a record in the database
> old string
> server1/folder1
> want to change to
> server2/folder1
> --
> Paul G
> Software engineer.
|||ok thanks for the information
Paul G
Software engineer.
"Absar Ahmad" wrote:
[vbcol=seagreen]
> REPLACE is one good option. Here is an example:
> create table #test111
> (scode int,
> sdesc varchar(30))
> insert into #test111 values (1,'server1/folder1')
> insert into #test111 values (2,'server1/folder1')
> update #test111 set sdesc = replace(sdesc,'server1/','server2/')
> where scode = 1
> select * from #test111
> "Paul" wrote:

any easy way to modify string in dbase

HI I have a database with a string as one of the fields and I need to modify
only a portion of the string. For example below is a record in the database
old string
server1/folder1
want to change to
server2/folder1
--
Paul G
Software engineer.REPLACE is one good option. Here is an example:
create table #test111
(scode int,
sdesc varchar(30))
insert into #test111 values (1,'server1/folder1')
insert into #test111 values (2,'server1/folder1')
update #test111 set sdesc = replace(sdesc,'server1/','server2/')
where scode = 1
select * from #test111
"Paul" wrote:

> HI I have a database with a string as one of the fields and I need to modi
fy
> only a portion of the string. For example below is a record in the databa
se
> old string
> server1/folder1
> want to change to
> server2/folder1
> --
> Paul G
> Software engineer.|||ok thanks for the information
--
Paul G
Software engineer.
"Absar Ahmad" wrote:
[vbcol=seagreen]
> REPLACE is one good option. Here is an example:
> create table #test111
> (scode int,
> sdesc varchar(30))
> insert into #test111 values (1,'server1/folder1')
> insert into #test111 values (2,'server1/folder1')
> update #test111 set sdesc = replace(sdesc,'server1/','server2/')
> where scode = 1
> select * from #test111
> "Paul" wrote:
>

any easy way to modify string in dbase

HI I have a database with a string as one of the fields and I need to modify
only a portion of the string. For example below is a record in the database
old string
server1/folder1
want to change to
server2/folder1
--
Paul G
Software engineer.REPLACE is one good option. Here is an example:
create table #test111
(scode int,
sdesc varchar(30))
insert into #test111 values (1,'server1/folder1')
insert into #test111 values (2,'server1/folder1')
update #test111 set sdesc = replace(sdesc,'server1/','server2/')
where scode = 1
select * from #test111
"Paul" wrote:
> HI I have a database with a string as one of the fields and I need to modify
> only a portion of the string. For example below is a record in the database
> old string
> server1/folder1
> want to change to
> server2/folder1
> --
> Paul G
> Software engineer.|||ok thanks for the information
--
Paul G
Software engineer.
"Absar Ahmad" wrote:
> REPLACE is one good option. Here is an example:
> create table #test111
> (scode int,
> sdesc varchar(30))
> insert into #test111 values (1,'server1/folder1')
> insert into #test111 values (2,'server1/folder1')
> update #test111 set sdesc = replace(sdesc,'server1/','server2/')
> where scode = 1
> select * from #test111
> "Paul" wrote:
> > HI I have a database with a string as one of the fields and I need to modify
> > only a portion of the string. For example below is a record in the database
> >
> > old string
> > server1/folder1
> > want to change to
> > server2/folder1
> > --
> > Paul G
> > Software engineer.

2012年2月11日星期六

ANSI_NULLS OFF SQL2K5

Hi folks,
I'm using SQL Server 2005 SP1 and wants to know how to set to OFF the
setting ANSI_NULLS. When I create or modify a SP, SQL Server 2005 proposes
automatically the settings (global)
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
When I modify the SP cliccking on "Script store procedure as" and then
"ALTER TO" to change the setting ANSI_NULLS to OFF, it remains in OFF. The
problem is when I modify the SP cliccking on "Modify"; if the SP was modified
first changing the ANSI_NULLS setting to OFF, SSMS continues to visualize
such setting in ON. Very weird!
Any insight about how to preserve such setting in OFF is really welcome.
Thanks. Roberto.BOBNET wrote:
> Hi folks,
> I'm using SQL Server 2005 SP1 and wants to know how to set to OFF the
> setting ANSI_NULLS. When I create or modify a SP, SQL Server 2005 proposes
> automatically the settings (global)
> SET ANSI_NULLS ON
> SET QUOTED_IDENTIFIER ON
> When I modify the SP cliccking on "Script store procedure as" and then
> "ALTER TO" to change the setting ANSI_NULLS to OFF, it remains in OFF. The
> problem is when I modify the SP cliccking on "Modify"; if the SP was modified
> first changing the ANSI_NULLS setting to OFF, SSMS continues to visualize
> such setting in ON. Very weird!
> Any insight about how to preserve such setting in OFF is really welcome.
> Thanks. Roberto.
If at all possible you should avoid setting ANSI_NULLS OFF. Use the ON
setting always. The only good reason I can think of to use the OFF
setting is in order to support legacy code that you can't change. If
you do use the OFF setting then some features are not supported and
worst of all your code will be harder for others to comprehend.
Set ANSI_NULLS in the script just before the CREATE PROC statement:
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC [dbo].[usp_proc]
...
You can also set Management Studio's default behaviour under Options /
Query Execution\SQL Server\ANSI. Changing this to OFF is definitely not
recommended because it will affect ALL new procs unless you remember to
specify otherwise.
--
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--

ANSI_NULLS OFF SQL2K5

Hi folks,
I'm using SQL Server 2005 SP1 and wants to know how to set to OFF the
setting ANSI_NULLS. When I create or modify a SP, SQL Server 2005 proposes
automatically the settings (global)
SET ANSI_NULLS ON
SET QUOTED_IDENTIFIER ON
When I modify the SP cliccking on "Script store procedure as" and then
"ALTER TO" to change the setting ANSI_NULLS to OFF, it remains in OFF. The
problem is when I modify the SP cliccking on "Modify"; if the SP was modifie
d
first changing the ANSI_NULLS setting to OFF, SSMS continues to visualize
such setting in ON. Very weird!
Any insight about how to preserve such setting in OFF is really welcome.
Thanks. Roberto.BOBNET wrote:
> Hi folks,
> I'm using SQL Server 2005 SP1 and wants to know how to set to OFF the
> setting ANSI_NULLS. When I create or modify a SP, SQL Server 2005 proposes
> automatically the settings (global)
> SET ANSI_NULLS ON
> SET QUOTED_IDENTIFIER ON
> When I modify the SP cliccking on "Script store procedure as" and then
> "ALTER TO" to change the setting ANSI_NULLS to OFF, it remains in OFF. The
> problem is when I modify the SP cliccking on "Modify"; if the SP was modif
ied
> first changing the ANSI_NULLS setting to OFF, SSMS continues to visualize
> such setting in ON. Very weird!
> Any insight about how to preserve such setting in OFF is really welcome.
> Thanks. Roberto.
If at all possible you should avoid setting ANSI_NULLS OFF. Use the ON
setting always. The only good reason I can think of to use the OFF
setting is in order to support legacy code that you can't change. If
you do use the OFF setting then some features are not supported and
worst of all your code will be harder for others to comprehend.
Set ANSI_NULLS in the script just before the CREATE PROC statement:
SET ANSI_NULLS OFF
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROC [dbo].[usp_proc]
...
You can also set Management Studio's default behaviour under Options /
Query Execution\SQL Server\ANSI. Changing this to OFF is definitely not
recommended because it will affect ALL new procs unless you remember to
specify otherwise.
David Portas, SQL Server MVP
Whenever possible please post enough code to reproduce your problem.
Including CREATE TABLE and INSERT statements usually helps.
State what version of SQL Server you are using and specify the content
of any error messages.
SQL Server Books Online:
http://msdn2.microsoft.com/library/ms130214(en-US,SQL.90).aspx
--