---
title: "MSSQL 游标使用"
author: "oxidy"
date: "2008-10-12T19:23:07Z"
tags: []
categories: ["数据库"]
slug: "mssql"
draft: false
lastmod: "2008-10-12T19:23:07Z"
id: 251855
url: "https://oxidy.iteye.com/blog/251855"
---

```
declare nn cursor static
for select id from user 
open nn
fetch next from nn into @id
while @@fetch_status = 0 
begin
      --处理语句
	fetch next from nn into @id
end
close nn
deallocate nn
```

 

 

静态游标，定义办法