Se afișează postările cu eticheta Sql Management Studio. Afișați toate postările
Se afișează postările cu eticheta Sql Management Studio. Afișați toate postările

duminică, 16 ianuarie 2011

Exporting MS SQL data as sql scripts

In PhpMyAdmin exporting data to sql statements not to .mdb files or other databases is very straight forward. When I first had to do this with Sql Management Studio I didn't know how at first.
Then I found out.
Basically, what you have to do is this:
1.right click on a database item
2.go to tasks -> generate scripts in the menu that appears

You now have a wizard that will help you generate scripts for the objects you need. You can either generate one script for all the objects in your database(tables, triggers, stored procedures etc) or one script for just some of the object(you choose which) or each object you choose in it's own script. You can either generate these resulting scripts in files or in new query windows. Everything is configurable from the options window(the wizard step with the title "Choose script options").

Here is an example:
I wanted to just script the triggers in a db. Each in it's own file.
In the options window I set "script triggers" to true and in the following wizard form(with the title "Output options") I chose "file per object".


vineri, 14 ianuarie 2011

Opening compressed databases or .mdf files in SQL Server Management Studio

If when you try to open a database or attaching a .mdf file you get the error:

is compressed but does not reside in a read-only database or filegroup. The file must be decompressed.

So here is the algorithm I followed to solve this issue:

1. only if an existing database gives this error detach the database – right click -> Detach

2. closed all SQL Server Management Studio instances

3. Stop the SQL Server service.. (Start->Run -> services.msc)

4. Selected .mdf file(should be blue if compressed ) Right click properties -> Advanced -> Uncheck "Compress files to save disk space"

5.(re)attach .mdf file

The Trie: A Neglected Data Structure

From the very first days in our lives as  programmers , we’ve all dealt with data structures: Arrays, linked lists, trees, sets, stacks and...