Showing posts with label delete. Show all posts
Showing posts with label delete. Show all posts

Thursday, March 29, 2012

Changing connection string to data source

Can I change databases for a SqlDataSource in code behind and still use the edit,inset,delete capabilities of the SQLDataSource control?

yes u can..

for change of connection string

SqlDataSource1.ConnectionString =ConfigurationManager.ConnectionStrings[0].ToString();

or

SqlDataSource1.ConnectionString ="UR connection string";

Tuesday, March 27, 2012

Changing Compatibility Level on an Upgraded SQL Server 2000 db to 2005 causing delete to b

I have just upgraded my SQL Server 2000 to SQL Server 2005 and from
what I understand the upgrade will do the database conversions for you.
After the install I tried to delete a row from my Item table which is a
foreign key to about 10 other tables. A simple
Delete Item Where ItemID = 888
In SQL Server 2000 it takes about 9secs. In SQL Server 2005 i have yet
to let it run successfully, i stop it after 5mins.
After the upgrade I changed the Compatibility Level to SQL Server 2005
(90) under Database Properties -> Options
After I changed the Compatibiliity Level back to SQL Server 2000 (80)
the query ran in approx 17 secs.
The Item table is about 8000 rows and the size of the tables
referencing the Item table varies. But why would changing the
Compatibility Level cause such a difference in performance? Did I miss
a step in upgrading? From what I understood, changing the Compatibility
Level just allows you to use new SQL Server 2005 features like MARS,
etc...
Please help.
thanks
benblan
UPDATE STATISTICS
REBUILD INDEXES
"blam" <bendlam@.gmail.com> wrote in message
news:1138810049.298299.209110@.g43g2000cwa.googlegroups.com...
>I have just upgraded my SQL Server 2000 to SQL Server 2005 and from
> what I understand the upgrade will do the database conversions for you.
> After the install I tried to delete a row from my Item table which is a
> foreign key to about 10 other tables. A simple
> Delete Item Where ItemID = 888
> In SQL Server 2000 it takes about 9secs. In SQL Server 2005 i have yet
> to let it run successfully, i stop it after 5mins.
> After the upgrade I changed the Compatibility Level to SQL Server 2005
> (90) under Database Properties -> Options
> After I changed the Compatibiliity Level back to SQL Server 2000 (80)
> the query ran in approx 17 secs.
> The Item table is about 8000 rows and the size of the tables
> referencing the Item table varies. But why would changing the
> Compatibility Level cause such a difference in performance? Did I miss
> a step in upgrading? From what I understood, changing the Compatibility
> Level just allows you to use new SQL Server 2005 features like MARS,
> etc...
> Please help.
> thanks
> ben
>|||thanks for the reply,
I did all that last night, rebuilt the indexes, updated the statistics,
etc...this morning the query still didn't run, i had to stop it after
5mins. Then all I did was change the compatibility level to SQL Server
2000 (80) then reran the query and it took 17secs.
Any other suggestions?|||blam wrote:
> thanks for the reply,
> I did all that last night, rebuilt the indexes, updated the statistics,
> etc...this morning the query still didn't run, i had to stop it after
> 5mins. Then all I did was change the compatibility level to SQL Server
> 2000 (80) then reran the query and it took 17secs.
> Any other suggestions?
Check the query plan with both compatibility levels. That may give a clue.|||Can you compare the execution plan with compatibility level 80 with the
excution plan with compatibility level 90
I found different values in the execution plan when i change the
compatibility level between 70 / 80.|||You may need to change your queries/stored procs. After we migrated to SQL
2005, some of the stored procedures slowed down to a crawl, even after
updating the stats and rebuilding the indexes. Due to changes in the database
engine from version to version (and even from service upgrades), the query
plans may change as well. We had do minor changes to the queries and sps in
order to get it back to the way it was performing on SQL 2000.
"gshadow1" wrote:
> Can you compare the execution plan with compatibility level 80 with the
> excution plan with compatibility level 90
> I found different values in the execution plan when i change the
> compatibility level between 70 / 80.
>
>

Wednesday, March 7, 2012

Change the default constraint

I hav a table with a column wich has a default constraint. I want to
remove this constraint and to add an other one whitout to delete the column.
It is posible?
Thanks for help!Sure...
ALTER TABLE YourTable
DROP CONSTRAINT DefaultConstraintName
Then...
ALTER TABLE YourTable
ADD CONSTRAINT DefaultConstraintName DEFAULT (default_value) FOR your_column
Adam Machanic
SQL Server MVP
http://www.sqljunkies.com/weblog/amachanic
--
"Mihaly" <Mihaly@.discussions.microsoft.com> wrote in message
news:2724888C-8E36-4D03-93F0-06ADCEEC711C@.microsoft.com...
> I hav a table with a column wich has a default constraint. I want to
> remove this constraint and to add an other one whitout to delete the
column.
> It is posible?
> Thanks for help!
>|||Mihaly,
Use alter table to drop the constraint and add the new one.
Example:
use northwind
go
create table t (
colA varchar(25) default ('sql server 2000')
)
go
insert into t default values
go
select * from t
go
declare @.sql nvarchar(4000)
declare @.cnstname sysname
select
@.cnstname = [name]
from
sysobjects as so
where
xtype = 'D'
and parent_obj = object_id('dbo.t')
and col_name(parent_obj, info) = 'colA'
if @.cnstname is not null
begin
set @.sql = N'alter table dbo.t drop constraint ' + @.cnstname
execute sp_executesql @.sql
end
go
alter table t
add constraint df_sql200 default ('sql server 200') for colA
go
insert into t default values
go
select * from t
go
alter table dbo.t drop constraint df_sql200
go
alter table t
add constraint df_sql2005 default ('sql server 2005') for colA
go
insert into t default values
go
select * from t
go
drop table t
go
AMB
"Mihaly" wrote:

> I hav a table with a column wich has a default constraint. I want to
> remove this constraint and to add an other one whitout to delete the colum
n.
> It is posible?
> Thanks for help!
>|||No. Not for you. And whose default is that (ba boom ching!)
Yes, it is possible:
create table test
(
test int,
defaulted int constraint default_test_defaulted default (10)
)
go
insert into test (test) values (1)
go
select * from test
go
alter table test drop constraint default_test_defaulted
--note, I didn't specify a constraint name
alter table test add default 20 for defaulted
--best practice would have included a name, but I wanted you to see what
would happen
--this is the right way:
--alter table test add constraint default_test_defaulted default 20 for
defaulted
--To find the name if you didn't give it a nice name
select * from sysobjects where xtype = 'D' and parent_obj =
object_id('test')
alter table test drop constraint DF__test__defaulted__79A81403
----
Louis Davidson - drsql@.hotmail.com
SQL Server MVP
Compass Technology Management - www.compass.net
Pro SQL Server 2000 Database Design -
http://www.apress.com/book/bookDisplay.html?bID=266
Blog - http://spaces.msn.com/members/drsql/
Note: Please reply to the newsgroups only unless you are interested in
consulting services. All other replies may be ignored :)
"Mihaly" <Mihaly@.discussions.microsoft.com> wrote in message
news:2724888C-8E36-4D03-93F0-06ADCEEC711C@.microsoft.com...
> I hav a table with a column wich has a default constraint. I want to
> remove this constraint and to add an other one whitout to delete the
> column.
> It is posible?
> Thanks for help!
>

Sunday, February 19, 2012

Change servername

Hi,
I moved jobs from a server to a new one with dts. However I cannot delete,
edit, enable, ... these jobs. If I try so I get the following error:
14274 Cannot add, update, or delete a job (or its steps or schedules) that
originated from an MSX server.
We changed the name of the server after it was installed from 'EDIFRAME-' to
'EDIFRAME'.
If I do SELECT @.@.SERVERNAME the result is 'EDIFRAME-' (This is the old
temporary name)
How can I change the servername because I think this is the problem?
Thanks in advance for any help.
Jo Segers.http://www.karaszi.com/SQLServer/info_change_server_name.asp
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jo Segers" <segers_jo@.hotmail.com> wrote in message news:e$AuIrvpEHA.1712@.tk2msftngp13.phx.gbl...
> Hi,
> I moved jobs from a server to a new one with dts. However I cannot delete,
> edit, enable, ... these jobs. If I try so I get the following error:
> 14274 Cannot add, update, or delete a job (or its steps or schedules) that
> originated from an MSX server.
> We changed the name of the server after it was installed from 'EDIFRAME-' to
> 'EDIFRAME'.
> If I do SELECT @.@.SERVERNAME the result is 'EDIFRAME-' (This is the old
> temporary name)
> How can I change the servername because I think this is the problem?
> Thanks in advance for any help.
> Jo Segers.
>|||Thanks for the information, this solved my problem.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
in bericht news:eT7K37vpEHA.2900@.TK2MSFTNGP12.phx.gbl...
> http://www.karaszi.com/SQLServer/info_change_server_name.asp
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jo Segers" <segers_jo@.hotmail.com> wrote in message
news:e$AuIrvpEHA.1712@.tk2msftngp13.phx.gbl...
> > Hi,
> >
> > I moved jobs from a server to a new one with dts. However I cannot
delete,
> > edit, enable, ... these jobs. If I try so I get the following error:
> >
> > 14274 Cannot add, update, or delete a job (or its steps or schedules)
that
> > originated from an MSX server.
> >
> > We changed the name of the server after it was installed from
'EDIFRAME-' to
> > 'EDIFRAME'.
> >
> > If I do SELECT @.@.SERVERNAME the result is 'EDIFRAME-' (This is the old
> > temporary name)
> >
> > How can I change the servername because I think this is the problem?
> >
> > Thanks in advance for any help.
> >
> > Jo Segers.
> >
> >
>

Change servername

Hi,
I moved jobs from a server to a new one with dts. However I cannot delete,
edit, enable, ... these jobs. If I try so I get the following error:
14274 Cannot add, update, or delete a job (or its steps or schedules) that
originated from an MSX server.
We changed the name of the server after it was installed from 'EDIFRAME-' to
'EDIFRAME'.
If I do SELECT @.@.SERVERNAME the result is 'EDIFRAME-' (This is the old
temporary name)
How can I change the servername because I think this is the problem?
Thanks in advance for any help.
Jo Segers.
http://www.karaszi.com/SQLServer/inf...erver_name.asp
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"Jo Segers" <segers_jo@.hotmail.com> wrote in message news:e$AuIrvpEHA.1712@.tk2msftngp13.phx.gbl...
> Hi,
> I moved jobs from a server to a new one with dts. However I cannot delete,
> edit, enable, ... these jobs. If I try so I get the following error:
> 14274 Cannot add, update, or delete a job (or its steps or schedules) that
> originated from an MSX server.
> We changed the name of the server after it was installed from 'EDIFRAME-' to
> 'EDIFRAME'.
> If I do SELECT @.@.SERVERNAME the result is 'EDIFRAME-' (This is the old
> temporary name)
> How can I change the servername because I think this is the problem?
> Thanks in advance for any help.
> Jo Segers.
>
|||Thanks for the information, this solved my problem.
"Tibor Karaszi" <tibor_please.no.email_karaszi@.hotmail.nomail.com> schreef
in bericht news:eT7K37vpEHA.2900@.TK2MSFTNGP12.phx.gbl...
> http://www.karaszi.com/SQLServer/inf...erver_name.asp
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> "Jo Segers" <segers_jo@.hotmail.com> wrote in message
news:e$AuIrvpEHA.1712@.tk2msftngp13.phx.gbl...[vbcol=seagreen]
delete,[vbcol=seagreen]
that[vbcol=seagreen]
'EDIFRAME-' to
>