SQL常用函数之三 REPLICATE () ?
按指定次数重复字符表达式。
语法
REPLICATE ( character_expression, integer_expression)
参数
character_expression
字符数据型的字母数字表达式,或者可以隐式转换为 nvarchar 或 ntext 的其他数据类型的字母数字表达式。
integer_expression
可以隐式转换为 int 的表达式。如果 integer_expression 为负,将返回空字符串。
返回值
nvarchar 或 ntext
1 :Select Replicate('abc',2) ----------------abcabc
2 :Select Replicate('abc',-2) ----------------null
3 :Select Replicate('abc',0)--------------- 无
相关文档:
1.DATEADD函数
在向指定日期加上一段时间的基础上,返回新的 datetime 值。
语法
DATEADD ( datepart , number, date )
参数
datepart
日期部分
缩写
Year
yy, yyyy
quarter
qq, q
Month
mm, m
dayofyear
dy, y
Day
dd, d
Week
wk, ww
Hour
hh
minute
mi, n
second
ss, s
millisecond
m ......
记取记录集
create procedure getArticle
as
select * from Article_Content
GO
asp.net 调用方法
SqlConnection Conn = new SqlConnection();
Conn.ConnectionString = Data.Connstr();
Conn.Open();
......
最近在找一次sql查询的无限分类查询的设计,网上找了一下这个数据表的设计很有特色,
不用递归,依靠个简单SQL语句就能列出菜单,看看这个数据表怎么设计的,并对下面的数据表结构的查询进行分析.
数据库字段大概如下:
-----------------------------------------------------------------------------------
id ......
----查看所有角本
Create table #y (txt text)
select name, iid = identity(int,1,1) into #x from SysObjects where xtype = 'TR'
declare @i int, @max int
declare @name varchar(40)
set @i = 1
select @max = max(iid) from #x
while @i <= @max
begin
select @name = name from #x w ......