Здравствуйте! Сегодня: Пт, 13 Дек 2019, Ваш IP: 34.225.194.144 Войти через loginza
 
Вход | Регистрация | Забыли пароль?
Мой Kbyte.Ru
> Список форумов Kbyte.Ru - - Общие вопросы программирования
+ Создать новую тему Страница: 1
Тема: Не удаляется индекс таблицы в базе northwind.SDF · +  +  дата добавления: 13.10.2015 / 13:44
Автор темы:
capetownn
capetownn
тем: 47 / ответов: 40 / благодарностей: 8 / репутация: 0
ответов: 40
создал(а) тем: 47


Среда Visual Basic STUDIO’2010 Professional
Необходимо программно удалить индекс 'aaaaa_2'
таблицы Customers в базе Northwind.sdf

последний вариант строки
Dim sIndex As New String("aaaaa_2") 
Dim sql3 As String = "DROP INDEX " + sIndex + " ON Customers"
cmd.ExecuteNonQuery()  
     MsgBox("Удаляемый индекс " + vbCrLf + sIndex + vbCrLf +
           "НЕ существует" & vbCrLf & ex.Message

Удаляемый индекс
aaaaa_2
НЕ существует
There was an error parsing the query. [ Token line number = 1,Token line offset = 20,Token in error = ON ]
Спасибо

Ниже апробированные варианты строк:

'+-2 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN " +
' "DROP INDEX aaaaa_2 ON dbo.Customers;END;"

'+-3 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN;" +
' "DROP INDEX aaaaa_2 ON dbo.Customers;END;"

'+-4 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN; " &
' "DROP INDEX aaaaa_2 ON dbo.Customers;END;"

'+-5 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN; " &
' "DROP INDEX aaaaa_2 ON dbo.Customers;END;"

'+-6 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN DROP INDEX aaaaa_2 ON dbo.Customers;END;"

'+-7 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN;DROP INDEX aaaaa_2 ON dbo.Customers;END;"

' Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN;DROP INDEX aaaaa_2 ON dbo.Customers;END;"
'+-2 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN;DROP INDEX aaaaa_2 ON dbo.Customers;END;"

'+-3 Dim sql3 As String = "IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN;DROP INDEX aaaaa_2 ON dbo.Customers;END;"
'+-4 Dim sql3 As New String("IF EXISTS(SELECT * FROM sys.indexes WHERE object_id = object_id('dbo.Customers') AND NAME ='aaaaa_2') BEGIN;DROP INDEX aaaaa_2 ON dbo.Customers;END;")

'+-6 Dim sql3 As String = "BEGIN DROP INDEX aaaaa_2 ON dbo.Customers;END;"
'+-7 Dim sql3 As String = "DROP INDEX aaaaa_2 ON dbo.Customers;END;"
'+-8 Dim sql3 As String = "DROP INDEX aaaaa_2 ON Customers"
'+-9 Dim sql3 As String = "DROP INDEX 'aaaaa_2' ON Customers"
'+-10 Dim sql3 As String = "DROP INDEX myIdx3 ON Customers"
Технологии: Visual Basic 5.0/6.0
 

Нет ответов в этой теме...

Страница: 1 + Создать новую тему