Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add For Clause [in Primary key]

Status
Not open for further replies.

Z1

Programmer
May 8, 2000
14
US
Hi there,<br><br>I want to put not deleted clause on the primary key to ignore deleted rows. Following command is giving syntax errors:<br><br>ALTER TABLE 'MYTABLE' ADD PRIMARY KEY MYKEY TAG MYKEY FOR NOT DELETED<br><br>Please help<br><br><br><br>
 
Sorry, Z1, no can do:&nbsp;&nbsp;while you can put a FOR clause in an index (including a unique index), you cannot use a FOR clause in the primary key definition. <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Hi Robert,<br><br>I was following the MSDN library info for ALTER TABLE where the above syntax was there. Do you think its a bug?<br><br>Thanks for your input.
 
<b>Ooops!</b>&nbsp;&nbsp;I checked the syntax in the online help before posting, but I didn't read down far enough, as there are multiple syntax skeletons presented.<br><br>You are in fact correct - one of the syntax skeletons does show that ability.<br><br>I think what you might need to do is add parentheses after DELETED, since it is a function.&nbsp;&nbsp;Your statement should be:<br><br><FONT FACE=monospace>ALTER TABLE 'MYTABLE' ;<br>ADD PRIMARY KEY MYKEY TAG MYKEY FOR NOT DELETED<b>()</b></font><br><br>I'm curious to find out if this works.<br><br> <p>Robert Bradley<br><a href=mailto: > </a><br><a href= - Visual FoxPro Development</a><br>
 
Hi Robert,<br><br>Thanks for your response.<br><br>I have already tried by adding (), but it still gives me the same error.<br><br><br><br>
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top