Thursday, 22 March 2012
Connect to MSDE by CMD
is ther a way to connect to the command line for MSDE. I want to export data
from the MSDE database with a command line script!
How can I accomplish that?
Thanx,
M.J.Use BCP.EXE
http://www.microsoft.com/technet/prodtechnol/sql/2000/books/c07ppcsq.mspx#EGAA
"Jan" wrote:
> Hello,
> is ther a way to connect to the command line for MSDE. I want to export data
> from the MSDE database with a command line script!
> How can I accomplish that?
> Thanx,
> M.J.
>
>|||use bcp.exe
http://www.microsoft.com/technet/prodtechnol/sql/2000/books/c07ppcsq.mspx#EGAA
"Jan" wrote:
> Hello,
> is ther a way to connect to the command line for MSDE. I want to export data
> from the MSDE database with a command line script!
> How can I accomplish that?
> Thanx,
> M.J.
>
>|||Hi,
Execute the below command from command prompt
BCP mydb.dbo.tab1 OUT c:\table.txt -c -SServername -Usa -Ppassword
You can also load the data into table using "BCP IN" command.
BCP mydb.dbo.tab2 IN c:\table.txt -c -SServername -Usa -Ppassword
Replace a Database name, Table name, server name , password with actuals.
Thanks
Hari
"Jan" wrote:
> Hello,
> is ther a way to connect to the command line for MSDE. I want to export data
> from the MSDE database with a command line script!
> How can I accomplish that?
> Thanx,
> M.J.
>
>|||Hello,
When using :
bcp db01.dbo.messages out export.txt -c -t, -Usa -P ****
I receive an error :
SQLState = S0002, NaviveError = 208
Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
'db01'.
MJ
"Hari Prasad" <HariPrasad@.discussions.microsoft.com> schreef in bericht
news:53CF5ED7-9278-4EAB-A726-36B02061B508@.microsoft.com...
> Hi,
> Execute the below command from command prompt
> BCP mydb.dbo.tab1 OUT c:\table.txt -c -SServername -Usa -Ppassword
> You can also load the data into table using "BCP IN" command.
> BCP mydb.dbo.tab2 IN c:\table.txt -c -SServername -Usa -Ppassword
> Replace a Database name, Table name, server name , password with actuals.
> Thanks
> Hari
> "Jan" wrote:
>> Hello,
>> is ther a way to connect to the command line for MSDE. I want to export
>> data
>> from the MSDE database with a command line script!
>> How can I accomplish that?
>> Thanx,
>> M.J.
>>|||Thank you all it works!!
"Jan" <jan@.msnews.com> schreef in bericht
news:ulK%23QqqRFHA.1564@.TK2MSFTNGP09.phx.gbl...
> Hello,
> When using :
> bcp db01.dbo.messages out export.txt -c -t, -Usa -P ****
> I receive an error :
> SQLState = S0002, NaviveError = 208
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
> 'db01'.
> MJ
> "Hari Prasad" <HariPrasad@.discussions.microsoft.com> schreef in bericht
> news:53CF5ED7-9278-4EAB-A726-36B02061B508@.microsoft.com...
>> Hi,
>> Execute the below command from command prompt
>> BCP mydb.dbo.tab1 OUT c:\table.txt -c -SServername -Usa -Ppassword
>> You can also load the data into table using "BCP IN" command.
>> BCP mydb.dbo.tab2 IN c:\table.txt -c -SServername -Usa -Ppassword
>> Replace a Database name, Table name, server name , password with actuals.
>> Thanks
>> Hari
>> "Jan" wrote:
>> Hello,
>> is ther a way to connect to the command line for MSDE. I want to export
>> data
>> from the MSDE database with a command line script!
>> How can I accomplish that?
>> Thanx,
>> M.J.
>>
>|||I personally like to use a query to identify and know the sequence of fields
you are retrieving so try:
bcp "SELECT field1,field2..etc FROM Table" queryout export.txt -c -t,
-S<ServerName\INSTANCE> -Usa -P*****
Make sure you include server name and if you are connecting to a specific
instance
-Ash
> bcp db01.dbo.messages out export.txt -c -t, -Usa -P ****
"Jan" wrote:
> Hello,
> When using :
> bcp db01.dbo.messages out export.txt -c -t, -Usa -P ****
> I receive an error :
> SQLState = S0002, NaviveError = 208
> Error = [Microsoft][ODBC SQL Server Driver][SQL Server]Invalid object name
> 'db01'.
> MJ
> "Hari Prasad" <HariPrasad@.discussions.microsoft.com> schreef in bericht
> news:53CF5ED7-9278-4EAB-A726-36B02061B508@.microsoft.com...
> > Hi,
> >
> > Execute the below command from command prompt
> >
> > BCP mydb.dbo.tab1 OUT c:\table.txt -c -SServername -Usa -Ppassword
> >
> > You can also load the data into table using "BCP IN" command.
> >
> > BCP mydb.dbo.tab2 IN c:\table.txt -c -SServername -Usa -Ppassword
> >
> > Replace a Database name, Table name, server name , password with actuals.
> >
> > Thanks
> > Hari
> >
> > "Jan" wrote:
> >
> >> Hello,
> >>
> >> is ther a way to connect to the command line for MSDE. I want to export
> >> data
> >> from the MSDE database with a command line script!
> >>
> >> How can I accomplish that?
> >>
> >> Thanx,
> >>
> >> M.J.
> >>
> >>
> >>
>
>sqlsql
Monday, 19 March 2012
Connect SQL database through ASP
to develop asp script to connect to the server database
(localhost). But I got invalid authorization error
message, any help will be greatly appreciated. Following
is my script:
<%Option Explicit%>
<html>
<head>
<title>Testing Connection1</title>
</head>
<body>
<%
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data
Source=C:\Program Files\Microsoft SQL
Server\MSSQL\Data\Master.mdf"
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnectionString
strSQL = "SELECT First_Name, Last_Name FROM
Member_Master"
objRS.Open strSQL, objConn
Set objFirstName = objRS("First_Name")
Set objLastName = objRS("Last_Name")
Do Until objRS.EOF
Response.Write objFirstName & " " & objLastName
& "<BR>"
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>
Thanks,
Sheridan
You have to set the DataSource in the connection string to the Server name,
not the operating system file name.
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data Source=(local)"
Should work, although it is better to replace (local) with the actual name
of the SQL Server (which should be the same as your computername if you have
a default installation).
Jacco Schalkwijk
SQL Server MVP
"Sheridan" <anonymous@.discussions.microsoft.com> wrote in message
news:25c0b01c46111$a9a8d950$a401280a@.phx.gbl...
> I have SQL Server 2000 installed on my machine and tried
> to develop asp script to connect to the server database
> (localhost). But I got invalid authorization error
> message, any help will be greatly appreciated. Following
> is my script:
> <%Option Explicit%>
> <html>
> <head>
> <title>Testing Connection1</title>
> </head>
> <body>
> <%
> Dim strConnectionString
> strConnectionString = "Provider=SQLOLEDB.1;Data
> Source=C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\Master.mdf"
> Dim objConn, objRS
> Set objConn = Server.CreateObject("ADODB.Connection")
> Set objRS = Server.CreateObject("ADODB.Recordset")
> objConn.Open strConnectionString
> strSQL = "SELECT First_Name, Last_Name FROM
> Member_Master"
> objRS.Open strSQL, objConn
> Set objFirstName = objRS("First_Name")
> Set objLastName = objRS("Last_Name")
> Do Until objRS.EOF
> Response.Write objFirstName & " " & objLastName
> & "<BR>"
> objRS.MoveNext
> Loop
> objRS.Close
> objConn.Close
> Set objRS = Nothing
> Set objConn = Nothing
> %>
> </body>
> </html>
> --
> Thanks,
> Sheridan
Connect SQL database through ASP
to develop asp script to connect to the server database
(localhost). But I got invalid authorization error
message, any help will be greatly appreciated. Following
is my script:
<%Option Explicit%>
<html>
<head>
<title>Testing Connection1</title>
</head>
<body>
<%
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data
Source=C:\Program Files\Microsoft SQL
Server\MSSQL\Data\Master.mdf"
Dim objConn, objRS
Set objConn = Server.CreateObject("ADODB.Connection")
Set objRS = Server.CreateObject("ADODB.Recordset")
objConn.Open strConnectionString
strSQL = "SELECT First_Name, Last_Name FROM
Member_Master"
objRS.Open strSQL, objConn
Set objFirstName = objRS("First_Name")
Set objLastName = objRS("Last_Name")
Do Until objRS.EOF
Response.Write objFirstName & " " & objLastName
& "<BR>"
objRS.MoveNext
Loop
objRS.Close
objConn.Close
Set objRS = Nothing
Set objConn = Nothing
%>
</body>
</html>
--
Thanks,
SheridanYou have to set the DataSource in the connection string to the Server name,
not the operating system file name.
Dim strConnectionString
strConnectionString = "Provider=SQLOLEDB.1;Data Source=(local)"
Should work, although it is better to replace (local) with the actual name
of the SQL Server (which should be the same as your computername if you have
a default installation).
Jacco Schalkwijk
SQL Server MVP
"Sheridan" <anonymous@.discussions.microsoft.com> wrote in message
news:25c0b01c46111$a9a8d950$a401280a@.phx
.gbl...
> I have SQL Server 2000 installed on my machine and tried
> to develop asp script to connect to the server database
> (localhost). But I got invalid authorization error
> message, any help will be greatly appreciated. Following
> is my script:
> <%Option Explicit%>
> <html>
> <head>
> <title>Testing Connection1</title>
> </head>
> <body>
> <%
> Dim strConnectionString
> strConnectionString = "Provider=SQLOLEDB.1;Data
> Source=C:\Program Files\Microsoft SQL
> Server\MSSQL\Data\Master.mdf"
> Dim objConn, objRS
> Set objConn = Server.CreateObject("ADODB.Connection")
> Set objRS = Server.CreateObject("ADODB.Recordset")
> objConn.Open strConnectionString
> strSQL = "SELECT First_Name, Last_Name FROM
> Member_Master"
> objRS.Open strSQL, objConn
> Set objFirstName = objRS("First_Name")
> Set objLastName = objRS("Last_Name")
> Do Until objRS.EOF
> Response.Write objFirstName & " " & objLastName
> & "<BR>"
> objRS.MoveNext
> Loop
> objRS.Close
> objConn.Close
> Set objRS = Nothing
> Set objConn = Nothing
> %>
> </body>
> </html>
> --
> Thanks,
> Sheridan
Sunday, 19 February 2012
Confirmation on Script Task Behavior
Hello,
I am looking for some confirmation on a behavior of the SSIS Script Task. I have a custom script task that takes an input file, and archives it after it has been processed into the database.
When I run this package in the Visual Studio GUI, if the destination drive is full, it throws an exception telling me that there is not enough disk space. So, my questions are:
1) If this happens when the package is running through the command line, would this exception still be thrown? (I am thinking it will be)
2) Also, Do I need to explicitly fail the script task in the event handler, in order to ensure this .Net exception being thrown will cause the component to fail. (I am fairly certain I do, since this is what I had to do inside of the Visual Studio GUI, but does anyone know if this same behavior would occur when running from the command line?)
Thanks,
Chris
If you don't catch the exception, it should cause your script task to fail. Otherwise, you would need to explicitly fail it by setting Dts.TaskResult=Dts.Results.Failure. The exception-related behavior will be the same between the GUI and the command-line.Tuesday, 14 February 2012
Configuring SQL
i want to develop some script to configure sql externally, can anyone
tell me how can i do so? and wether this is possible or not?
the type of configurations that i need, setting sa password, deleting
guest account,Remove sample databases, Audit Login events, Restrict
CmdExec rights to SysAdmins,...
i want to develop a script to enforce the configurations above by
executing this script
any ideas??
> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
1) sp_password (setting sa password)
2) sp_dropsuer 'guest'
3) drop database 'dbname' (Remove sample databases)
4) Run sql server Profiler (Audit Login events)
5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
sp_droprolemember system stored procedure
<Eng.Rana@.gmail.com> wrote in message
news:1163934268.329344.18750@.m73g2000cwd.googlegro ups.com...
> hi all,
> i want to develop some script to configure sql externally, can anyone
> tell me how can i do so? and wether this is possible or not?
> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
> i want to develop a script to enforce the configurations above by
> executing this script
> any ideas??
>
|||Hi
Some of the things you are wanting to do may be configurable during the
installation see
http://msdn2.microsoft.com/en-us/library/ms144259.aspx if using SQL2005. You
may also want to look at using SMO.
John
"Eng.Rana@.gmail.com" wrote:
> hi all,
> i want to develop some script to configure sql externally, can anyone
> tell me how can i do so? and wether this is possible or not?
> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
> i want to develop a script to enforce the configurations above by
> executing this script
> any ideas??
>
|||thanx John
but actually i don want to do so while installation, i want to run such
a script to recfonfigure the already installed SQLs, to be secure
i'm using SQL 2000
John Bell wrote:[vbcol=seagreen]
> Hi
> Some of the things you are wanting to do may be configurable during the
> installation see
> http://msdn2.microsoft.com/en-us/library/ms144259.aspx if using SQL2005. You
> may also want to look at using SMO.
> John
> "Eng.Rana@.gmail.com" wrote:
Configuring SQL
i want to develop some script to configure sql externally, can anyone
tell me how can i do so' and wether this is possible or not'
the type of configurations that i need, setting sa password, deleting
guest account,Remove sample databases, Audit Login events, Restrict
CmdExec rights to SysAdmins,...
i want to develop a script to enforce the configurations above by
executing this script
any ideas'?> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
1) sp_password (setting sa password)
2) sp_dropsuer 'guest'
3) drop database 'dbname' (Remove sample databases)
4) Run sql server Profiler (Audit Login events)
5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
sp_droprolemember system stored procedure
<Eng.Rana@.gmail.com> wrote in message
news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
> hi all,
> i want to develop some script to configure sql externally, can anyone
> tell me how can i do so' and wether this is possible or not'
> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
> i want to develop a script to enforce the configurations above by
> executing this script
> any ideas'?
>|||thanx for the reply
but how can i run these externally, shall i develope some code, using
.NET for example to call these stored procedures
or can i write some script to call them externally, all at once
Uri Dimant wrote:[vbcol=seagreen]
> 1) sp_password (setting sa password)
> 2) sp_dropsuer 'guest'
> 3) drop database 'dbname' (Remove sample databases)
> 4) Run sql server Profiler (Audit Login events)
> 5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
> sp_droprolemember system stored procedure
>
> <Eng.Rana@.gmail.com> wrote in message
> news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...|||Yep, you'll have to develop some code in T-SQL as well
<Eng.Rana@.gmail.com> wrote in message
news:1163936328.124164.100050@.m7g2000cwm.googlegroups.com...
> thanx for the reply
> but how can i run these externally, shall i develope some code, using
> .NET for example to call these stored procedures
> or can i write some script to call them externally, all at once
> Uri Dimant wrote:
>|||Hi
Some of the things you are wanting to do may be configurable during the
installation see
http://msdn2.microsoft.com/en-us/library/ms144259.aspx if using SQL2005. You
may also want to look at using SMO.
John
"Eng.Rana@.gmail.com" wrote:
> hi all,
> i want to develop some script to configure sql externally, can anyone
> tell me how can i do so' and wether this is possible or not'
> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
> i want to develop a script to enforce the configurations above by
> executing this script
> any ideas'?
>|||thanx John
but actually i don want to do so while installation, i want to run such
a script to recfonfigure the already installed SQLs, to be secure
i'm using SQL 2000
John Bell wrote:[vbcol=seagreen]
> Hi
> Some of the things you are wanting to do may be configurable during the
> installation see
> http://msdn2.microsoft.com/en-us/library/ms144259.aspx if using SQL2005. Y
ou
> may also want to look at using SMO.
> John
> "Eng.Rana@.gmail.com" wrote:
>|||thanx
but isn't there any other way to do the same job'
Uri Dimant wrote:[vbcol=seagreen]
> Yep, you'll have to develop some code in T-SQL as well
>
> <Eng.Rana@.gmail.com> wrote in message
> news:1163936328.124164.100050@.m7g2000cwm.googlegroups.com...|||Have a .sql file containing the commands, which you kick off using SQLCMD.EX
E or OSQL.EXE?
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<Eng.Rana@.gmail.com> wrote in message news:1163953498.340666.124840@.f16g2000cwb.googlegroups
.com...
> thanx
> but isn't there any other way to do the same job'
> Uri Dimant wrote:
>|||thanx Tibor
what if i want to take an exteranl args from users like the new sa
password for example
Tibor Karaszi wrote:[vbcol=seagreen]
> Have a .sql file containing the commands, which you kick off using SQLCMD.
EXE or OSQL.EXE?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> <Eng.Rana@.gmail.com> wrote in message news:1163953498.340666.124840@.f16g20
00cwb.googlegroups.com...|||> what if i want to take an exteranl args from users like the new sa
> password for example
SQLCMD.EXE (shipped with 2005) has support for variables. In the script file
, you specify $(varname)
and when you run the script, you use the -v option to specify a value for a
variable. But it
definitely seems like you should provide the end-user with a proper small ap
p to do these changes.
Much more robust...
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<Eng.Rana@.gmail.com> wrote in message news:1163957220.279868.20100@.e3g2000cwe.googlegroups.c
om...
> thanx Tibor
> what if i want to take an exteranl args from users like the new sa
> password for example
> Tibor Karaszi wrote:
>
Configuring SQL
i want to develop some script to configure sql externally, can anyone
tell me how can i do so' and wether this is possible or not'
the type of configurations that i need, setting sa password, deleting
guest account,Remove sample databases, Audit Login events, Restrict
CmdExec rights to SysAdmins,...
i want to develop a script to enforce the configurations above by
executing this script
any ideas'?> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
1) sp_password (setting sa password)
2) sp_dropsuer 'guest'
3) drop database 'dbname' (Remove sample databases)
4) Run sql server Profiler (Audit Login events)
5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
sp_droprolemember system stored procedure
<Eng.Rana@.gmail.com> wrote in message
news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
> hi all,
> i want to develop some script to configure sql externally, can anyone
> tell me how can i do so' and wether this is possible or not'
> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
> i want to develop a script to enforce the configurations above by
> executing this script
> any ideas'?
>|||thanx for the reply :)
but how can i run these externally, shall i develope some code, using
.NET for example to call these stored procedures
or can i write some script to call them externally, all at once
Uri Dimant wrote:
> > the type of configurations that i need, setting sa password, deleting
> > guest account,Remove sample databases, Audit Login events, Restrict
> > CmdExec rights to SysAdmins,...
> 1) sp_password (setting sa password)
> 2) sp_dropsuer 'guest'
> 3) drop database 'dbname' (Remove sample databases)
> 4) Run sql server Profiler (Audit Login events)
> 5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
> sp_droprolemember system stored procedure
>
> <Eng.Rana@.gmail.com> wrote in message
> news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
> > hi all,
> >
> > i want to develop some script to configure sql externally, can anyone
> > tell me how can i do so' and wether this is possible or not'
> >
> > the type of configurations that i need, setting sa password, deleting
> > guest account,Remove sample databases, Audit Login events, Restrict
> > CmdExec rights to SysAdmins,...
> >
> > i want to develop a script to enforce the configurations above by
> > executing this script
> >
> > any ideas'?
> >|||Yep, you'll have to develop some code in T-SQL as well
<Eng.Rana@.gmail.com> wrote in message
news:1163936328.124164.100050@.m7g2000cwm.googlegroups.com...
> thanx for the reply :)
> but how can i run these externally, shall i develope some code, using
> .NET for example to call these stored procedures
> or can i write some script to call them externally, all at once
> Uri Dimant wrote:
>> > the type of configurations that i need, setting sa password, deleting
>> > guest account,Remove sample databases, Audit Login events, Restrict
>> > CmdExec rights to SysAdmins,...
>> 1) sp_password (setting sa password)
>> 2) sp_dropsuer 'guest'
>> 3) drop database 'dbname' (Remove sample databases)
>> 4) Run sql server Profiler (Audit Login events)
>> 5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
>> sp_droprolemember system stored procedure
>>
>> <Eng.Rana@.gmail.com> wrote in message
>> news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
>> > hi all,
>> >
>> > i want to develop some script to configure sql externally, can anyone
>> > tell me how can i do so' and wether this is possible or not'
>> >
>> > the type of configurations that i need, setting sa password, deleting
>> > guest account,Remove sample databases, Audit Login events, Restrict
>> > CmdExec rights to SysAdmins,...
>> >
>> > i want to develop a script to enforce the configurations above by
>> > executing this script
>> >
>> > any ideas'?
>> >
>|||Hi
Some of the things you are wanting to do may be configurable during the
installation see
http://msdn2.microsoft.com/en-us/library/ms144259.aspx if using SQL2005. You
may also want to look at using SMO.
John
"Eng.Rana@.gmail.com" wrote:
> hi all,
> i want to develop some script to configure sql externally, can anyone
> tell me how can i do so' and wether this is possible or not'
> the type of configurations that i need, setting sa password, deleting
> guest account,Remove sample databases, Audit Login events, Restrict
> CmdExec rights to SysAdmins,...
> i want to develop a script to enforce the configurations above by
> executing this script
> any ideas'?
>|||thanx John
but actually i don want to do so while installation, i want to run such
a script to recfonfigure the already installed SQLs, to be secure :)
i'm using SQL 2000
John Bell wrote:
> Hi
> Some of the things you are wanting to do may be configurable during the
> installation see
> http://msdn2.microsoft.com/en-us/library/ms144259.aspx if using SQL2005. You
> may also want to look at using SMO.
> John
> "Eng.Rana@.gmail.com" wrote:
> > hi all,
> >
> > i want to develop some script to configure sql externally, can anyone
> > tell me how can i do so' and wether this is possible or not'
> >
> > the type of configurations that i need, setting sa password, deleting
> > guest account,Remove sample databases, Audit Login events, Restrict
> > CmdExec rights to SysAdmins,...
> >
> > i want to develop a script to enforce the configurations above by
> > executing this script
> >
> > any ideas'?
> >
> >|||thanx :)
but isn't there any other way to do the same job'
Uri Dimant wrote:
> Yep, you'll have to develop some code in T-SQL as well
>
> <Eng.Rana@.gmail.com> wrote in message
> news:1163936328.124164.100050@.m7g2000cwm.googlegroups.com...
> > thanx for the reply :)
> > but how can i run these externally, shall i develope some code, using
> > .NET for example to call these stored procedures
> > or can i write some script to call them externally, all at once
> >
> > Uri Dimant wrote:
> >> > the type of configurations that i need, setting sa password, deleting
> >> > guest account,Remove sample databases, Audit Login events, Restrict
> >> > CmdExec rights to SysAdmins,...
> >>
> >> 1) sp_password (setting sa password)
> >> 2) sp_dropsuer 'guest'
> >> 3) drop database 'dbname' (Remove sample databases)
> >> 4) Run sql server Profiler (Audit Login events)
> >> 5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
> >> sp_droprolemember system stored procedure
> >>
> >>
> >>
> >> <Eng.Rana@.gmail.com> wrote in message
> >> news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
> >> > hi all,
> >> >
> >> > i want to develop some script to configure sql externally, can anyone
> >> > tell me how can i do so' and wether this is possible or not'
> >> >
> >> > the type of configurations that i need, setting sa password, deleting
> >> > guest account,Remove sample databases, Audit Login events, Restrict
> >> > CmdExec rights to SysAdmins,...
> >> >
> >> > i want to develop a script to enforce the configurations above by
> >> > executing this script
> >> >
> >> > any ideas'?
> >> >
> >|||Have a .sql file containing the commands, which you kick off using SQLCMD.EXE or OSQL.EXE?
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<Eng.Rana@.gmail.com> wrote in message news:1163953498.340666.124840@.f16g2000cwb.googlegroups.com...
> thanx :)
> but isn't there any other way to do the same job'
> Uri Dimant wrote:
>> Yep, you'll have to develop some code in T-SQL as well
>>
>> <Eng.Rana@.gmail.com> wrote in message
>> news:1163936328.124164.100050@.m7g2000cwm.googlegroups.com...
>> > thanx for the reply :)
>> > but how can i run these externally, shall i develope some code, using
>> > .NET for example to call these stored procedures
>> > or can i write some script to call them externally, all at once
>> >
>> > Uri Dimant wrote:
>> >> > the type of configurations that i need, setting sa password, deleting
>> >> > guest account,Remove sample databases, Audit Login events, Restrict
>> >> > CmdExec rights to SysAdmins,...
>> >>
>> >> 1) sp_password (setting sa password)
>> >> 2) sp_dropsuer 'guest'
>> >> 3) drop database 'dbname' (Remove sample databases)
>> >> 4) Run sql server Profiler (Audit Login events)
>> >> 5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
>> >> sp_droprolemember system stored procedure
>> >>
>> >>
>> >>
>> >> <Eng.Rana@.gmail.com> wrote in message
>> >> news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
>> >> > hi all,
>> >> >
>> >> > i want to develop some script to configure sql externally, can anyone
>> >> > tell me how can i do so' and wether this is possible or not'
>> >> >
>> >> > the type of configurations that i need, setting sa password, deleting
>> >> > guest account,Remove sample databases, Audit Login events, Restrict
>> >> > CmdExec rights to SysAdmins,...
>> >> >
>> >> > i want to develop a script to enforce the configurations above by
>> >> > executing this script
>> >> >
>> >> > any ideas'?
>> >> >
>> >
>|||thanx Tibor :)
what if i want to take an exteranl args from users like the new sa
password for example
Tibor Karaszi wrote:
> Have a .sql file containing the commands, which you kick off using SQLCMD.EXE or OSQL.EXE?
> --
> Tibor Karaszi, SQL Server MVP
> http://www.karaszi.com/sqlserver/default.asp
> http://www.solidqualitylearning.com/
>
> <Eng.Rana@.gmail.com> wrote in message news:1163953498.340666.124840@.f16g2000cwb.googlegroups.com...
> > thanx :)
> > but isn't there any other way to do the same job'
> >
> > Uri Dimant wrote:
> >> Yep, you'll have to develop some code in T-SQL as well
> >>
> >>
> >>
> >> <Eng.Rana@.gmail.com> wrote in message
> >> news:1163936328.124164.100050@.m7g2000cwm.googlegroups.com...
> >> > thanx for the reply :)
> >> > but how can i run these externally, shall i develope some code, using
> >> > .NET for example to call these stored procedures
> >> > or can i write some script to call them externally, all at once
> >> >
> >> > Uri Dimant wrote:
> >> >> > the type of configurations that i need, setting sa password, deleting
> >> >> > guest account,Remove sample databases, Audit Login events, Restrict
> >> >> > CmdExec rights to SysAdmins,...
> >> >>
> >> >> 1) sp_password (setting sa password)
> >> >> 2) sp_dropsuer 'guest'
> >> >> 3) drop database 'dbname' (Remove sample databases)
> >> >> 4) Run sql server Profiler (Audit Login events)
> >> >> 5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
> >> >> sp_droprolemember system stored procedure
> >> >>
> >> >>
> >> >>
> >> >> <Eng.Rana@.gmail.com> wrote in message
> >> >> news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
> >> >> > hi all,
> >> >> >
> >> >> > i want to develop some script to configure sql externally, can anyone
> >> >> > tell me how can i do so' and wether this is possible or not'
> >> >> >
> >> >> > the type of configurations that i need, setting sa password, deleting
> >> >> > guest account,Remove sample databases, Audit Login events, Restrict
> >> >> > CmdExec rights to SysAdmins,...
> >> >> >
> >> >> > i want to develop a script to enforce the configurations above by
> >> >> > executing this script
> >> >> >
> >> >> > any ideas'?
> >> >> >
> >> >
> >|||> what if i want to take an exteranl args from users like the new sa
> password for example
SQLCMD.EXE (shipped with 2005) has support for variables. In the script file, you specify $(varname)
and when you run the script, you use the -v option to specify a value for a variable. But it
definitely seems like you should provide the end-user with a proper small app to do these changes.
Much more robust...
--
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
<Eng.Rana@.gmail.com> wrote in message news:1163957220.279868.20100@.e3g2000cwe.googlegroups.com...
> thanx Tibor :)
> what if i want to take an exteranl args from users like the new sa
> password for example
> Tibor Karaszi wrote:
>> Have a .sql file containing the commands, which you kick off using SQLCMD.EXE or OSQL.EXE?
>> --
>> Tibor Karaszi, SQL Server MVP
>> http://www.karaszi.com/sqlserver/default.asp
>> http://www.solidqualitylearning.com/
>>
>> <Eng.Rana@.gmail.com> wrote in message
>> news:1163953498.340666.124840@.f16g2000cwb.googlegroups.com...
>> > thanx :)
>> > but isn't there any other way to do the same job'
>> >
>> > Uri Dimant wrote:
>> >> Yep, you'll have to develop some code in T-SQL as well
>> >>
>> >>
>> >>
>> >> <Eng.Rana@.gmail.com> wrote in message
>> >> news:1163936328.124164.100050@.m7g2000cwm.googlegroups.com...
>> >> > thanx for the reply :)
>> >> > but how can i run these externally, shall i develope some code, using
>> >> > .NET for example to call these stored procedures
>> >> > or can i write some script to call them externally, all at once
>> >> >
>> >> > Uri Dimant wrote:
>> >> >> > the type of configurations that i need, setting sa password, deleting
>> >> >> > guest account,Remove sample databases, Audit Login events, Restrict
>> >> >> > CmdExec rights to SysAdmins,...
>> >> >>
>> >> >> 1) sp_password (setting sa password)
>> >> >> 2) sp_dropsuer 'guest'
>> >> >> 3) drop database 'dbname' (Remove sample databases)
>> >> >> 4) Run sql server Profiler (Audit Login events)
>> >> >> 5) Read "CmdExec jobs" in the BOL (Restrict CmdExec rights to SysAdmins),
>> >> >> sp_droprolemember system stored procedure
>> >> >>
>> >> >>
>> >> >>
>> >> >> <Eng.Rana@.gmail.com> wrote in message
>> >> >> news:1163934268.329344.18750@.m73g2000cwd.googlegroups.com...
>> >> >> > hi all,
>> >> >> >
>> >> >> > i want to develop some script to configure sql externally, can anyone
>> >> >> > tell me how can i do so' and wether this is possible or not'
>> >> >> >
>> >> >> > the type of configurations that i need, setting sa password, deleting
>> >> >> > guest account,Remove sample databases, Audit Login events, Restrict
>> >> >> > CmdExec rights to SysAdmins,...
>> >> >> >
>> >> >> > i want to develop a script to enforce the configurations above by
>> >> >> > executing this script
>> >> >> >
>> >> >> > any ideas'?
>> >> >> >
>> >> >
>> >
>
Configuring SQL
i want to develop some script to configure sql externally, can anyone
tell me how can i do so?? and wether this is possible or not??
the type of configurations that i need, setting sa password, deleting
guest account,Remove sample databases, Audit Login events, Restrict
CmdExec rights to SysAdmins,...
i want to develop a script to enforce the configurations above by
executing this script
any ideas???Have you considered using the Script-Task in the SSIS-package? AFAIK you
can access all functions there and write your Script in VB.NET code.
--
Benedikt Ries
----------------------
Benedikt Ries's Profile: http://www.dbtalk.net/m1098
View this thread: http://www.dbtalk.net/t345220|||Thanx Benedikt :),
plz note i'm using SQL server 2000
any other ideas??
Benedikt Ries wrote:
Quote:
Originally Posted by
Have you considered using the Script-Task in the SSIS-package? AFAIK you
can access all functions there and write your Script in VB.NET code.
>
>
--
Benedikt Ries
----------------------
Benedikt Ries's Profile: http://www.dbtalk.net/m1098
View this thread: http://www.dbtalk.net/t345220
want.
something like :
SET SERVERNAME=XYZ
SET DBNAME=ABC
SET USERNAME=ABC
SET PSW=ABC
ISQLW -U%USERNAME% -P%PSW% -S%SERVERNAME% -d%DBNAME%
-ic:\temp\script1.SQL -oLOGFILE.LOG -FA -n
TYPE LOGFILE.LOG >FULLLOG.LOG
ISQLW -U%USERNAME% -P%PSW% -S%SERVERNAME% -d%DBNAME%
-ic:\temp\script3.SQL -oLOGFILE.LOG -FA -n
TYPE LOGFILE.LOG >FULLLOG.LOG
Eng.Rana@.gmail.com wrote:
Quote:
Originally Posted by
Thanx Benedikt :),
plz note i'm using SQL server 2000
>
any other ideas??
>
>
Benedikt Ries wrote:
Quote:
Originally Posted by
Have you considered using the Script-Task in the SSIS-package? AFAIK you
can access all functions there and write your Script in VB.NET code.
--
Benedikt Ries
----------------------
Benedikt Ries's Profile: http://www.dbtalk.net/m1098
View this thread: http://www.dbtalk.net/t345220