sqlserver数据库创建视图时如何改变字段类型以及查询视图详细内容

时间:2025-03-17 21:31:32
创建或修改视图:

create(alter)  view abc as

select

           as lId,

           cast( as int) as password,                       字符串 ---> int

           cast( as int) as ageInt,                                      字符串 ---> int

           convert(nvarchar(255),) as idString,                   int --->  字符串

           convert(nvarchar(255),) as weightString,    int --->  字符串

           convert (nvarchar(255) , ) as priceString       int --->  字符串

from as l , as p

;


重点关注cast 和 convert 关键字的用法。


sp_help 视图名字;查询视图详细内容

----------------------------------------------------------------------------------------------------------

下方这些为转载信息:

1、ALTER viewtest1  as