Posts tagged sql server 2005

SQL Server Management Objects with VB.net

SQL Serverâ„¢ Management Objects (SMO) offer developers a robust toolset for operations such as backing up and restoring databases, and issuing Data Definition Language (DDL) commands. Using SQL SMO you can also connect to SQL Server, iterate through a collection of database objects and perform a variety of tasks against them.

I have been created simple program using vb.net 2008 and sql server 2005 using SQL SMO.
Read the rest of this entry »

  • Share/Bookmark

Microsoft SQL Server 2005 Cursor Example

DECLARE @id INT
DECLARE @name varchar(25)
DECLARE db_cursor CURSOR FOR
SELECT id,name From myTable
OPEN db_cursor
FETCH NEXT FROM db_cursor INTO @id, @name

WHILE @@FETCH_STATUS = 0
BEGIN
– do something
FETCH NEXT FROM db_cursor INTO @id, @name
END

CLOSE db_cursor
DEALLOCATE db_cursor

  • Share/Bookmark