已经生成的月底库存表 stock_month_list part_no ,end_qty和采购明细表 material_delivery_list part_no,delivery_date,standard_qty(采购数量),standard_price
解决方案 »
- sql2008怎么安装
- 求一条语句的写法
- SQL Server 2005的触发器和存储过程如何保存啊,我怎么保存起成了SQL查询文件去了,保存不在服务器上,
- 大数据操作的问题?
- VS2008 SQL2008R2 安装顺序
- 小可新学,多多指教,请问怎么对比两个datetime 类型?
- 把文本文件导入sql server中的日期处理问题。
- 请教sp_addlinkedsrvlogin的用法
- !!请问,以后FOXPRO还有没有希望,还有必要学吗?!!
- 在存儲過程中, 想在一個臨時表中while一下,不知可不可以
- 数据库输入的文字变成问号!!!!!如何解决...请教各位...
- 请教:关于SQL SERVER 2000数据库加密
http://community.csdn.net/Expert/topic/4704/4704065.xml?temp=.3512537
SET NOCOUNT ON
DECLARE @iNextRowId int,@iCurrentRowId int,@iLoopControl int,@ID int
-- Initialize variables!
SELECT @iLoopControl = 1
SELECT @iNextRowId = MIN(id) FROM tblA
-- Make sure the table has data.
IF ISNULL(@iNextRowId,0) = 0
BEGIN
SELECT 'No data in found in table!'
RETURN
END
-- Retrieve the first row
SELECT @iCurrentRowId = id,@id = ID FROM tblA WHERE id = @iNextRowId
-- start the main processing loop.
WHILE @iLoopControl = 1
BEGIN
-- This is where you perform your detailed row-by-row
-- processing.
-- Reset looping variables.
SELECT 'A'
SELECT @iNextRowId = NULL
-- get the next iRowId
SELECT @iNextRowId = MIN(id)FROM tblA WHERE ID > @iCurrentRowId
-- did we get a valid next row id?
IF ISNULL(@iNextRowId,0) = 0
BEGIN
BREAK
END
-- get the next row.
SELECT @iCurrentRowId = ID,@ID = ID FROM tblA WHERE ID = @iNextRowId
END
RETURN
ST NOCOUNT OFF