Главная страница
    Top.Mail.Ru    Яндекс.Метрика
Форум: "Базы";
Текущий архив: 2008.08.31;
Скачать: [xml.tar.bz2];

Вниз

Работа с типом данных TABLE   Найти похожие ветки 

 
harisma   (2008-03-04 14:13) [0]

Кто подскажет, почему не работает такой код:

declare @tbl TABLE(RECID varchar(16))
select D.RECID into @tbl
FROM dictionaries_C3AD665D2FD8E140 as D

?


 
Sergey13 ©   (2008-03-04 14:14) [1]

> [0] harisma   (04.03.08 14:13)
> почему не работает такой код:

А как он не работает?


 
harisma   (2008-03-04 14:19) [2]

Server: Msg 170, Level 15, State 1, Line 2
Line 2: Incorrect syntax near "@tbl".


 
harisma   (2008-03-04 14:19) [3]

У меня MSSQL 2000


 
Johnmen ©   (2008-03-04 14:20) [4]

А где он не работает?


 
clickmaker ©   (2008-03-04 14:45) [5]

может, поэтому:

The SELECT INTO statement creates a new table and populates it with the result set of the SELECT. The structure of the new table is defined by the attributes of the expressions in the select list

...

Within its scope, a table variable may be used like a regular table. It may be applied anywhere a table or table expression is used in SELECT, INSERT, UPDATE, and DELETE statements. However, table may not be used in the following statements:
INSERT INTO table_variable EXEC stored_procedure

SELECT select_list INTO table_variable statements

(c) BOL


 
Ega23 ©   (2008-03-04 14:59) [6]

Потому, что
Insert into @tbl (recID)
 Select D.recID  FROM dictionaries_C3AD665D2FD8E140 as D


 
harisma   (2008-03-04 15:42) [7]

А можно как-то без команды INSERT мою проблему решить?


 
Павел Калугин ©   (2008-03-04 16:07) [8]


> А можно как-то без команды INSERT мою проблему решить?

можно. тогда лишнее
declare @tbl TABLE(RECID varchar(16))

достаточно просто
select D.RECID into #tbl
FROM dictionaries_C3AD665D2FD8E140 as D



Страницы: 1 вся ветка

Форум: "Базы";
Текущий архив: 2008.08.31;
Скачать: [xml.tar.bz2];

Наверх





Память: 0.46 MB
Время: 0.005 c
6-1192736496
DprPasDcu
2007-10-18 23:41
2008.08.31
Как управлять сетевыми подключениями?


15-1215575465
engine
2008-07-09 07:51
2008.08.31
Поздравляю с победой на ImagineCup


15-1215472113
Pavia
2008-07-08 03:08
2008.08.31
WALL·E


15-1215912547
AFHU
2008-07-13 05:29
2008.08.31
Имя России. Исторический выбор-2008


2-1216816296
lavgirls
2008-07-23 16:31
2008.08.31
Програ для отображения трафика





Afrikaans Albanian Arabic Armenian Azerbaijani Basque Belarusian Bulgarian Catalan Chinese (Simplified) Chinese (Traditional) Croatian Czech Danish Dutch English Estonian Filipino Finnish French
Galician Georgian German Greek Haitian Creole Hebrew Hindi Hungarian Icelandic Indonesian Irish Italian Japanese Korean Latvian Lithuanian Macedonian Malay Maltese Norwegian
Persian Polish Portuguese Romanian Russian Serbian Slovak Slovenian Spanish Swahili Swedish Thai Turkish Ukrainian Urdu Vietnamese Welsh Yiddish Bengali Bosnian
Cebuano Esperanto Gujarati Hausa Hmong Igbo Javanese Kannada Khmer Lao Latin Maori Marathi Mongolian Nepali Punjabi Somali Tamil Telugu Yoruba
Zulu
Английский Французский Немецкий Итальянский Португальский Русский Испанский