Showing posts with label scripts. Show all posts
Showing posts with label scripts. Show all posts

Wednesday, March 28, 2012

HOw to Saving data from SQL server

Hi

I have only read ( select access) in a sql server database(2000). I am able to scripts the database.

Can any ony have any idea how to extract the data from database?

not the backup of db, i don't have the access.

No DTS to extract data into text file.

some thing like save the table with data?

I have more than 300 tables.

Thanks

sandipan

I think you don't have many options here. If you only have select permission; the only option I see is to export the data via Select...from... You could script a create table and then load it into a new DB where you, perhaps have rights to create a backup.

You could do all that using SSIS.

sql

How to save SQL 2005 solution?

Hi,
I have a solution within SQL 2005, which contains scripts of all
stored procs and views so that they are in source control. My
question is, how can I save this so that every time I open up SQL 2005
management strudio, it appears in the right hand pane, instead of
having to open it up every time.
Thanks for any assistance.How about having a shortcut for the sln file on your desktop?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"nomad" <d.bedgood@.ntlworld.com> wrote in message
news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
> Hi,
> I have a solution within SQL 2005, which contains scripts of all
> stored procs and views so that they are in source control. My
> question is, how can I save this so that every time I open up SQL 2005
> management strudio, it appears in the right hand pane, instead of
> having to open it up every time.
> Thanks for any assistance.
>|||On Feb 22, 3:29 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:
> How about having a shortcut for the sln file on your desktop?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asphttp://www.solidqualitylearning.com/
> "nomad" <d.bedg...@.ntlworld.com> wrote in message
> news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
> > Hi,
> > I have a solution within SQL 2005, which contains scripts of all
> > stored procs and views so that they are in source control. My
> > question is, how can I save this so that every time I open up SQL 2005
> > management strudio, it appears in the right hand pane, instead of
> > having to open it up every time.
> > Thanks for any assistance.
Is that the only way? Also, it is very slow loading them all. Think
I might just stick to using souce safe without the solution.

How to save SQL 2005 solution?

Hi,
I have a solution within SQL 2005, which contains scripts of all
stored procs and views so that they are in source control. My
question is, how can I save this so that every time I open up SQL 2005
management strudio, it appears in the right hand pane, instead of
having to open it up every time.
Thanks for any assistance.How about having a shortcut for the sln file on your desktop?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
"nomad" <d.bedgood@.ntlworld.com> wrote in message
news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
> Hi,
> I have a solution within SQL 2005, which contains scripts of all
> stored procs and views so that they are in source control. My
> question is, how can I save this so that every time I open up SQL 2005
> management strudio, it appears in the right hand pane, instead of
> having to open it up every time.
> Thanks for any assistance.
>|||On Feb 22, 3:29 pm, "Tibor Karaszi"
<tibor_please.no.email_kara...@.hotmail.nomail.com> wrote:[vbcol=seagreen]
> How about having a shortcut for the sln file on your desktop?
> --
> Tibor Karaszi, SQL Server MVPhttp://www.karaszi.com/sqlserver/default.asph
ttp://www.solidqualitylearning.com/
> "nomad" <d.bedg...@.ntlworld.com> wrote in message
> news:1172157510.539730.34010@.k78g2000cwa.googlegroups.com...
>
>
>
Is that the only way? Also, it is very slow loading them all. Think
I might just stick to using souce safe without the solution.

Friday, March 23, 2012

how to run sql scripts from commandline in MSDE

Hi,
I am trying to run sql scripts from Commandline, i am getting the error "the database doesnot exist use sp_helpdb to show available databases".
I am running this sql query to create database table, appreciate your help.
ThanksWhat SQL query are you running and what is the connection string you're using?

How To Run SQL Script

Hi,

I have a SQL script which create few tables.
Currently, I have to paste the scripts to the SQL Enterprise Manager
and highlight one by one to run it. It can't seem to run it as "one
unit".

My script looks like below:

CREATE TABLE T1 AS ...;
CREATE TABLE T2 AS ...;

Any comments?

Thanks in advance.You can run them as a single unit, if these are just CREATE TABLE
statements. Are you getting any errors?

However if you are creating objects with cyclic dependencies you may have to
make sure the dependant objects must be created before the parent object.
One alternative to this is to use CREATE SCHEMA DDL & details can be found
in SQL Server Books Online.

--
- Anith
( Please reply to newsgroups only )

Sunday, February 19, 2012

How to restrict evil create scripts?

Hi,

For a service I'm working on I need to ask the user for their database
create script. It's used to re-create the users database schema in a
temporary database on a in-house server in an automated fashion.

For security reasons, I need to be sure that the create script can only
create tables, columns etc and not things like snooping in other
databases and/or formatting the server.

Can you give me pointers about what the minimum grants are to let good
script execute successfully and evil scripts fail?

Regards,

WardWard,

I would say as long as your permissions are set right you don't have to
worry. If your user only have rights in their own databases they
shouldn't be able to accessother user databases. Xp_Cmdshell which
would be able to delete files or run other OS commands is (by default)
only available to members of the sysadmin role.
So I would say create a empty datbase and grant the user only db_owner
or ddl_admin rights within the database.

Markus|||Ward Bekker (ward@.NospaaMequanimity.nl) writes:

Quote:

Originally Posted by

For a service I'm working on I need to ask the user for their database
create script. It's used to re-create the users database schema in a
temporary database on a in-house server in an automated fashion.
>
For security reasons, I need to be sure that the create script can only
create tables, columns etc and not things like snooping in other
databases and/or formatting the server.
>
Can you give me pointers about what the minimum grants are to let good
script execute successfully and evil scripts fail?


First of all, which version of SQL Server including service pack do you
have?

As M.Bohse said, run the scripts as a user who only have access in that
database, although in that database he need some privs. Very important:
make sure that cross-database chaining is turned off, and that the
database is not set as trustworthy on SQL 2005.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx|||Hi Erland,

Thanks for the tips!

We are running SQL Server 2005.

Ward

Erland Sommarskog wrote:

Quote:

Originally Posted by

Ward Bekker (ward@.NospaaMequanimity.nl) writes:

Quote:

Originally Posted by

>For a service I'm working on I need to ask the user for their database
>create script. It's used to re-create the users database schema in a
>temporary database on a in-house server in an automated fashion.
>>
>For security reasons, I need to be sure that the create script can only
>create tables, columns etc and not things like snooping in other
>databases and/or formatting the server.
>>
>Can you give me pointers about what the minimum grants are to let good
>script execute successfully and evil scripts fail?


>
First of all, which version of SQL Server including service pack do you
have?
>
As M.Bohse said, run the scripts as a user who only have access in that
database, although in that database he need some privs. Very important:
make sure that cross-database chaining is turned off, and that the
database is not set as trustworthy on SQL 2005.
>
>

|||Ward Bekker (ward@.NospaaMequanimity.nl) writes:

Quote:

Originally Posted by

Hi Erland,
>
Thanks for the tips!
>
We are running SQL Server 2005.


In that case you should grant CONTROL on the dbo schema for the database
user. Maybe they are creating other scheams, but then they need to include
GRANTs for that.

You should also use

select name, is_trustworthy_on, is_db_chaining_on
from sys.databases

to make sure that the databases are not marked as trustworthy, or available
for DB-chaning.

--
Erland Sommarskog, SQL Server MVP, esquel@.sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx

How to restrict evil create scripts?

Hi,
For a service I'm working on I need to ask the user for their database
create script. It's used to re-create the users database schema in a
temporary database on a in-house server in an automated fashion.
For security reasons, I need to be sure that the create script can only
create tables, columns etc and not things like snooping in other
databases and/or formatting the server.
Can you give me pointers about what the minimum grants are to let good
script execute successfully and evil scripts fail?
Regards,
Ward
Ward Bekker
"Asp.Net Discussions for the Professional Developer"
http://www.dotnettaxi.com
"Free .Net 2.0 C# to/from VB.Net Code Converter"
http://www.dotnettaxi.com/Tools/Converter.aspxI would consider using Virtual Server isolation.
Set up a virtual server, save copies of the vhd/vmc files (set the file
properties to read only), and then each time you have such a script, use a
virtualized environment and 'evil' scripts won't have anything to sniff
around it.
When finished, just delete the VM.
Arnie Rowland, Ph.D.
Westwood Consulting, Inc
Most good judgment comes from experience.
Most experience comes from bad judgment.
- Anonymous
"Ward Bekker" <ward@.NospaaMequanimity.nl> wrote in message
news:eb7es3$c9a$1@.news.cistron.nl...
> Hi,
> For a service I'm working on I need to ask the user for their database
> create script. It's used to re-create the users database schema in a
> temporary database on a in-house server in an automated fashion.
> For security reasons, I need to be sure that the create script can only
> create tables, columns etc and not things like snooping in other databases
> and/or formatting the server.
> Can you give me pointers about what the minimum grants are to let good
> script execute successfully and evil scripts fail?
> Regards,
> Ward
>
> --
> Ward Bekker
> "Asp.Net Discussions for the Professional Developer"
> http://www.dotnettaxi.com
> "Free .Net 2.0 C# to/from VB.Net Code Converter"
> http://www.dotnettaxi.com/Tools/Converter.aspx|||Hi Arnie,
Interesting approach. Is great as a "second line" of defense. SQL Server
can have advanced security configuration, so I was wondering what could
be done in that level. Do you have any idea's about how that?
Thank you,
Ward
Arnie Rowland wrote:
> I would consider using Virtual Server isolation.
> Set up a virtual server, save copies of the vhd/vmc files (set the file
> properties to read only), and then each time you have such a script, use a
> virtualized environment and 'evil' scripts won't have anything to sniff
> around it.
> When finished, just delete the VM.
>