sql 查询出来一个表在插入到另一个表里
ALTER FUNCTION [dbo].[fun_tongji]()
RETURNS @t1 table (
yue int ,
money int
)
AS
begin
Declare @i int
set @i=1
-- declare @t1 table (
-- yue int ,
-- money int
-- )
while (@i<=12)
begin
INSERT into @t1 (yue,money) select isnull(sum(money),0) as money,@i as yue from zhangbenjilu where datepart(month,usedatetime)=@i
set @i=@i+1
end
return ;
end
相关文档:
外键
======================
外键是相对于主键说的,是建立表之间 的联系的必须的前提。
比如:学生表 、学生成绩表一一对应是因为 他们都具有相同的字段:学号,把学生表作为主表,学号是他的主键,相对于主表来说,学生成绩的字段 学号就是学生表的外键。
没有外键,两个表就没办法建立联系啊! ......
< type="text/javascript">
document.body.oncopy = function() {
if (window.clipboardData) {
setTimeout(function() {
var text = clipboardData.getData("text");
......
正确的:select isnull(money,0) from (select sum(money) as money,3 as b from zhangbenjilu where datepart(month,usedatetime)=3) as a
错误的:select isnull(money,0) from (select sum(money) as money,3 from zhangbenjilu where datepart(month,usedatetime)=3) ......
原文转自:http://tech.it168.com/a2009/0218/265/000000265868.shtml
索引是以表列为基础的数据库对象。索引中保存着表中排序的索引列,并且纪录了索引列在数据库表中的物理存储位置,实现了表中数据的逻辑排序。通过索引,可以加快数据的查询速度和减少系统的响应时间;可以使表和表之间的连接速度加快。
但是, ......
SQL注入式攻击是利用是指利用设计上的漏洞,在目标服务器上运行Sql命令以及进行其他方式的攻击动态生成Sql命令时没有对用户输入的数据进行
验证是Sql注入攻击得逞的主要原因。
比如:
如果你的查询语句是select * from admin where
username="&user&" and password="&pwd&"&quo ......