Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 Data Corruption Issues
 How to change value in a primary key in SQL

Author  Topic 

jje
Starting Member

4 Posts

Posted - 2008-09-21 : 05:04:22
Hi,

I have a small business server 2003 premium running (included SQL)
On this SBS 2003 I have SAP busines one running using the SQL server.

My problem is, that I, by mistake and don't ask me how, have inserted an addres in the businespartner code field, which is causing troble when ever I want to make a query from businespartners table "OCRD" Item "Cardcode"

Is it possible to thange the value of this businespartners cardcode?

I have tryed with "MS SQL Server Find and Replace Software" but it only changes all other values and not, what I call the primary key.
It also seems that some refferences to this businespartne disapears.

Can any one help me solve this problem?

Kind regards

Jan Jensen


visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-21 : 05:09:53
Is Cardcode the primary key of table? is it an identity column?
Go to Top of Page

jje
Starting Member

4 Posts

Posted - 2008-09-21 : 06:46:30
quote:
Originally posted by visakh16

Is Cardcode the primary key of table? is it an identity column?



Unfortunally I am not a pro!
As far as I can see, is it a primary key!
I am not sure how i can see if it is an identity column, bu there is no mark or sign in the column "ID" on the table proberties!
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-21 : 07:17:23
quote:
Originally posted by jje

quote:
Originally posted by visakh16

Is Cardcode the primary key of table? is it an identity column?



Unfortunally I am not a pro!
As far as I can see, is it a primary key!
I am not sure how i can see if it is an identity column, bu there is no mark or sign in the column "ID" on the table proberties!


Take the table definition and see. the below will give you table definition

sp_help yourtablename
Go to Top of Page

jje
Starting Member

4 Posts

Posted - 2008-09-21 : 07:43:54
This is the answer I get from SQL query analyzer

No identity column defined. NULL NULL NULL
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-21 : 07:58:43
run this and see whatt other tables are dependent on this table
sp_depends yourtablename
Go to Top of Page

jje
Starting Member

4 Posts

Posted - 2008-09-21 : 12:31:03
This is the answer on sp_depends

bwuser.SBO_CUSTOMER_ATTR view
bwuser.SBO_CUSTOMER_TEXT view
bwuser.SBO_VENDOR_ATTR view
bwuser.SBO_VENDOR_TEXT view
dbo.TmSp_RebuildMatchHistory stored procedure
dbo.TmSp_SetBalanceByJdt stored procedure
dbo.TmSp_SetVendorDeductPercent stored procedure
Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2008-09-21 : 13:04:32
quote:
Originally posted by jje

This is the answer on sp_depends

bwuser.SBO_CUSTOMER_ATTR view
bwuser.SBO_CUSTOMER_TEXT view
bwuser.SBO_VENDOR_ATTR view
bwuser.SBO_VENDOR_TEXT view
dbo.TmSp_RebuildMatchHistory stored procedure
dbo.TmSp_SetBalanceByJdt stored procedure
dbo.TmSp_SetVendorDeductPercent stored procedure



so i guess there's no other table dependent on your table. so you could update value using simple update. just use

UPDATE OCRD
SET Cardcode=newvalue
WHERE Cardcode=yourwrongvalue
Go to Top of Page
   

- Advertisement -