Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Remove constraint from VFP app
Message
General information
Forum:
Microsoft SQL Server
Category:
Other
Miscellaneous
Thread ID:
01639883
Message ID:
01639905
Views:
61
>First, thank you very much.
>When I run the above code from the VFP application, the line that DROPs INDEX, get this error message:
>
>Incorrect syntax near 'INDEX'. If this is intended as a part of a table hint, A WITH keyword and parenthesis are now required. 
>
>Where do I need to add the 'WITH'?

Sorry,

DROP INDEX is separate command, not ALTER TABLE one ;-)
TEXT TO lcSQL NOSHOW 
IF EXISTS(SELECT * FROM sys.indexes WHERE OBJECT_name(object_id) ='MyTable' AND Name = 'IX_CATEGORY_UNIQUE')
   BEGIN
      EXEC sp_executesql N'DROP INDEX IX_CATEGORY_UNIQUE ON dbo.MyTable'
      EXEC sp_executesql N'CREATE UNIQUE NONCLUSTERED INDEX [IX_CATEGORY_UNIQUENEW]  ON dbo.MyTable
                          ([SITE_NO],[CATEGORY])WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF,
                           SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]'
   END
ENDTEXT
sqlexec....
Against Stupidity the Gods themselves Contend in Vain - Johann Christoph Friedrich von Schiller
The only thing normal about database guys is their tables.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform