首先學(xué)習(xí)兩個函數(shù)
declare @a varchar(50) set @a='2009年7月15日星期五' select substring(@a,1,4) --獲取年份2009 declare @b int set @b=patindex('%日%',@a) --獲取'日'這個字符在字符串中的位置,即10 select substring(@a,6,@b-5) --獲取日期'7月15日'
posted on 2010-10-21 18:01 Brandon 閱讀(271) 評論(0) 編輯 收藏 引用 所屬分類: SQL
Powered by: C++博客 Copyright © Brandon