您好,我正在爲我的數據庫使用SQL Server 8.0。我不知道如何插入用戶定義數據。在sql server中插入用戶定義的數據
這是我的桌子。
column name: data type length allow_nulls
study_type_id int 4
study_type_name UD_NAME(varchar) 150
study_type_abbrev UD_NAME_SHORT(varchar) 50
order int
UD_NAME
和UD_NAME_SHORT
是在SQL企業管理用戶定義的數據類型。基類型是varchar。 當我用下面插入命令,
INSERT into study_type VALUES (15, 'test', 'TT',100)
它給了我"Implicit_conversion_error"
我無法看到ASP網頁鏈接到該表。
而且
INSERT into study_type (study_type_id, study_type_name, study_type_abbrev, order)
VALUES (15,CAST('test' as UD_NAME),CAST('TT' as UD_NAME_SHORT),100)
然後它說"type UD_NAME is not defined system type."
的SQL Server 8.0或SQL Server 2008? 8.0 = SQL Server 2000.您可以顯示UD類型的定義,確保您位於正確的數據庫中,並且不要嘗試從ASP網頁進行調試。另外,我強烈建議不要首先使用別名類型:http://sqlblog.com/blogs/aaron_bertrand/archive/2009/10/14/bad-habits-to-kick-using-alias-types.aspx – 2012-02-10 14:05:46