Имя пользователя:
Пароль:  
Помощь | Регистрация | Забыли пароль?  

Название темы: запросы в Microsoft Sql Server
Показать сообщение отдельно

Новый участник


Сообщения: 7
Благодарности: 0

Профиль | Отправить PM | Цитировать


Не буду открывать новую тему а отпишусь здесь:

Наличие:
WinXP Prof SP2
MS SQL 2000 Developers Edition
база с таблицами для менеджеров (не суть важна какая база)

Действие:
с помощью встроеннй утилиты SQL Query Analyzer выполняем запрос типа(вообщем-то не суть важно какой запрос):
Цитата:
begin
set nocount on
create table #FullIndex(
table_name sysname,
index_name sysname,
index_description varchar(210),
index_keys nvarchar(2078)
)

declare @TableName sysname
declare @IndexName sysname
declare @index_keys nvarchar(2078)
declare @sql nvarchar(4000)

declare c cursor for
select
name
from sysobjects
where name like N'tbl_%'
and xtype = N'U'
order by name

open c

while 1 = 1
begin
fetch next from c into @TableName

if @@fetch_status = -1 break
if @@fetch_status = -2 continue

create table #Index(
index_name sysname,
index_description varchar(210),
index_keys nvarchar(2078)
)

insert into #Index
exec sp_helpindex @TableName

insert into #FullIndex (table_name, index_name, index_description, index_keys)
select @TableName, index_name, index_description, index_keys
from #Index

drop table #Index
end
close c
deallocate c

declare c cursor for
select table_name, index_name from #FullIndex
where index_description like '%nonclustered%'
and index_description like '%unique%'
order by table_name

open c

while 1 = 1
begin
fetch next from c into @TableName, @IndexName

if @@fetch_status = -1 break
if @@fetch_status = -2 continue

print N' drop index [' + @TableName + N'].[' + @IndexName + N']'
end
close c
deallocate c


declare c cursor for
select table_name, index_name, index_keys from #FullIndex
where index_description like '%nonclustered%'
and index_description like '%unique%'
order by table_name

open c

while 1 = 1
begin
fetch next from c into @TableName, @IndexName, @index_keys

if @@fetch_status = -1 break
if @@fetch_status = -2 continue

print N' create unique index [' + @IndexName + N'] on [' + @TableName + N'] (' + @index_keys + N') '
end
close c
deallocate c

drop table #FullIndex
set nocount off
end
ожидаем во вкладке"Messages" получить что-то типа:
Цитата:
drop index [tb1_AdminUnit]_[UIX_tbl_AdminUnit_Name]
...
...
create unique index [UIX_tbl_AdminUnit_Name] on [tbl_AdminUnit] (Name, IsGroup)
...
...

ОДНАКО вместо ожидаемой таблицы получаем сообщение:
Цитата:
The command(s) completed succefuly


Замечу что при выполнении простого запроса типа: "select @@version"
--> получаем ожидаемый результат с версией мускуля и всё такое

Вопрос: как мне увидеть ожидаемую таблицу или на худой конец сообщение об ошибке.. а не банальное"The command(s) completed succefuly" ????

Предпринятые меры к исправлению:
привинтил SP4 к MSSQL -- результат тот же..

Отправлено: 14:49, 23-03-2008 | #7

Название темы: запросы в Microsoft Sql Server