每天在sql表中插入多少行 [英] How Many rows Inserted in sql table per day

查看:91
本文介绍了每天在sql表中插入多少行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在一个表中插入了1000行,但插入了200行未插入的行为什么?

I am inserting 1000 rows in a table, but 200 rows inserted remaining rows not inserted why?

insert into tbl_Product(ProductName,PuchasePkng,NoOfUnits)
select Name,Packing,Units from prd



请帮助我

提前致谢


please help me
Thanks in advance

推荐答案

答案真的取决于你的表结构和实现细节,首先运行下面的查询,看看你想要插入什么:

The answer really depends on your table structure and implementation details, start by running the query below and see what you are trying to insert :
select Name,Packing,Units from prd


你怎么知道你要插入1000行?



首先需要确定prd表中有多少行。检查计数如下:



How do you know that you are inserting 1000 rows?

You first need to determine how many rows are present in prd table. Check the count like this:

SELECT Count(0) FROM prd


怎么样 @@ ROWCOUNT [ ^ ]?



看看例子:

What about @@ROWCOUNT[^]?

Have a look at example:
DECLARE @fTable TABLE (ID INT IDENTITY(1,1), SomeVal INT)
DECLARE @sTable TABLE (ID INT IDENTITY(1,1), SomeVal INT)

INSERT INTO @fTable (SomeVal)
SELECT 1
UNION ALL SELECT 2
UNION ALL SELECT 3
UNION ALL SELECT 4
UNION ALL SELECT 5

DECLARE @RowCount INT

SELECT @RowCount = COUNT(*)
FROM @fTable


INSERT INTO @sTable (SomeVal)
SELECT SomeVal
FROM @fTable


SELECT @@ROWCOUNT AS RecordsAffected, @RowCount AS RecordsSelected





使用 @@ ROWCOUNT 你会得到号码。受上一个语句影响的行数。在这种情况下,使用 INSERT INTO



Using @@ROWCOUNT you'll get the no. of rows affected by last statement. In this case with INSERT INTO.


这篇关于每天在sql表中插入多少行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆