DECLARE @QUERY VARCHAR(255)
select @QUERY = dbo.sysindexes.name from dbo.sysindexes where id = 
object_id(N'[dbo].[ovt_emp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1 and 
dbo.sysindexes.name like 'PK%'
IF EXISTS ( select * from dbo.sysindexes where id = 
object_id(N'[dbo].[ovt_emp]') and OBJECTPROPERTY(id, N'IsUserTable') = 1 and 
dbo.sysindexes.name like 'PK%' ) 
EXEC ( 'ALTER TABLE ovt_emp DROP CONSTRAINT ' + @QUERY )
GO

COBA SEPERTI DI ATAS
Itu generic, jadi klo untuk table yang berbeda tinggal ganti nama tablenya aja.
semoga membantu

yazid <[EMAIL PROTECTED]> wrote:

ALTER TABLE "dba"."ovt_emp" DELETE DELETE PRIMARY KEY;
ALTER TABLE "dba"."ovt_emp" ADD PRIMARY KEY("ocb_emp_id","ocb_month")

Query diatas adalah utk menghapus dan membuat primary key di suatu 
table, 
1. bagaimana query utk menghapus INDEX
2. bagaimana query utk membuat INDEX

thanks
Yazid





-----------------------------------------------
INDOPB TURUT BERDUKA CITA UNTUK ACEH & SUMUT 
-----------------------------------------------
IndoPB - Indonesia PB User Group 
To Post a message, send it to: [EMAIL PROTECTED]
To Unsubscribe,send a blank message to: [EMAIL PROTECTED] 


Yahoo! Groups SponsorADVERTISEMENT


---------------------------------
Yahoo! Groups Links

   To visit your group on the web, go to:
http://groups.yahoo.com/group/indopb/
  
   To unsubscribe from this group, send an email to:
[EMAIL PROTECTED]
  
   Your use of Yahoo! Groups is subject to the Yahoo! Terms of Service. 




Wahyu Kurniawan, A.Md. 
HP    : 08561884559



                
---------------------------------
Do you Yahoo!?
 Yahoo! Small Business - Try our new resources site! 

[Non-text portions of this message have been removed]



-----------------------------------------------
 INDOPB TURUT BERDUKA CITA UNTUK ACEH & SUMUT 
-----------------------------------------------
IndoPB - Indonesia PB User Group 
To Post a message, send it to: [EMAIL PROTECTED]
To Unsubscribe,send a blank message to: [EMAIL PROTECTED] 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/indopb/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Kirim email ke