Thursday, March 29, 2012
Default name for domain
windows machine, and I want to know if there's a way for me not to have to
specify the machine domain name.
Something like the '.\sqlexpress' name to identify the sqlexpress instance
in running in the local machine:
CREATE LOGIN [.\O2 - Viewer] FROM WINDOWS
Does something like this exist?
Regards,
Pablo MontillaOne option is to use variables and dynamically build the
SQL statements to create the logins. You can get the server
name using
select @.@.servername
You can use that to build the login names specific for a
machine.
-Sue
On Wed, 21 Mar 2007 18:31:41 -0300, "Pablo Montilla"
<melkor@.odyssey.com.uy> wrote:
>Hello, I'm creating a script that will create logins for groups of a
>windows machine, and I want to know if there's a way for me not to have to
>specify the machine domain name.
>Something like the '.\sqlexpress' name to identify the sqlexpress instance
>in running in the local machine:
>CREATE LOGIN [.\O2 - Viewer] FROM WINDOWS
>Does something like this exist?
>Regards,
>Pablo Montilla
>|||Many thanks, I'll try that.
Pablo
On Wed, 21 Mar 2007 22:00:19 -0300, Sue Hoegemeier <Sue_H@.nomail.please>
wrote:
> One option is to use variables and dynamically build the
> SQL statements to create the logins. You can get the server
> name using
> select @.@.servername
> You can use that to build the login names specific for a
> machine.
> -Sue
> On Wed, 21 Mar 2007 18:31:41 -0300, "Pablo Montilla"
> <melkor@.odyssey.com.uy> wrote:
>
>
Wednesday, March 21, 2012
Dedicated Database Connection
Currently, we are creating a new database call to get each ID we need. We
are considering the idea of keeping a database connection open with a single
responsibility of retrieving a new primary key. Can you provide me a
response to the following questions?:
Are there any timeouts on open connections to the database from within SQL
Server?
Can you think of negative impacts this could have on the database to have a
consistent open connections?newie wrote:
> We are looking at ways to optimize our process for retrieving primary
> keys. Currently, we are creating a new database call to get each ID
> we need. We are considering the idea of keeping a database
> connection open with a single responsibility of retrieving a new
> primary key. Can you provide me a response to the following
> questions?:
> Are there any timeouts on open connections to the database from
> within SQL Server?
> Can you think of negative impacts this could have on the database to
> have a consistent open connections?
Conistent open connections are the standard for many client-server
applications. Even something like IIS would likely use connection
pooling and keep a certain number of connections open. There is no
problem with an open connection. In fact, in most cases it can improve
application performance.
--
David Gugick
Quest Software
www.imceda.com
www.quest.com|||take a look at connection pooling
http://sqlservercode.blogspot.com/
"newie" wrote:
> We are looking at ways to optimize our process for retrieving primary keys.
> Currently, we are creating a new database call to get each ID we need. We
> are considering the idea of keeping a database connection open with a single
> responsibility of retrieving a new primary key. Can you provide me a
> response to the following questions?:
> Are there any timeouts on open connections to the database from within SQL
> Server?
> Can you think of negative impacts this could have on the database to have a
> consistent open connections?
>sql
Dedicated Database Connection
Currently, we are creating a new database call to get each ID we need. We
are considering the idea of keeping a database connection open with a single
responsibility of retrieving a new primary key. Can you provide me a
response to the following questions?:
Are there any timeouts on open connections to the database from within SQL
Server?
Can you think of negative impacts this could have on the database to have a
consistent open connections?
newie wrote:
> We are looking at ways to optimize our process for retrieving primary
> keys. Currently, we are creating a new database call to get each ID
> we need. We are considering the idea of keeping a database
> connection open with a single responsibility of retrieving a new
> primary key. Can you provide me a response to the following
> questions?:
> Are there any timeouts on open connections to the database from
> within SQL Server?
> Can you think of negative impacts this could have on the database to
> have a consistent open connections?
Conistent open connections are the standard for many client-server
applications. Even something like IIS would likely use connection
pooling and keep a certain number of connections open. There is no
problem with an open connection. In fact, in most cases it can improve
application performance.
David Gugick
Quest Software
www.imceda.com
www.quest.com
|||take a look at connection pooling
http://sqlservercode.blogspot.com/
"newie" wrote:
> We are looking at ways to optimize our process for retrieving primary keys.
> Currently, we are creating a new database call to get each ID we need. We
> are considering the idea of keeping a database connection open with a single
> responsibility of retrieving a new primary key. Can you provide me a
> response to the following questions?:
> Are there any timeouts on open connections to the database from within SQL
> Server?
> Can you think of negative impacts this could have on the database to have a
> consistent open connections?
>
Dedicated Database Connection
Currently, we are creating a new database call to get each ID we need. We
are considering the idea of keeping a database connection open with a single
responsibility of retrieving a new primary key. Can you provide me a
response to the following questions?:
Are there any timeouts on open connections to the database from within SQL
Server?
Can you think of negative impacts this could have on the database to have a
consistent open connections?newie wrote:
> We are looking at ways to optimize our process for retrieving primary
> keys. Currently, we are creating a new database call to get each ID
> we need. We are considering the idea of keeping a database
> connection open with a single responsibility of retrieving a new
> primary key. Can you provide me a response to the following
> questions?:
> Are there any timeouts on open connections to the database from
> within SQL Server?
> Can you think of negative impacts this could have on the database to
> have a consistent open connections?
Conistent open connections are the standard for many client-server
applications. Even something like IIS would likely use connection
pooling and keep a certain number of connections open. There is no
problem with an open connection. In fact, in most cases it can improve
application performance.
David Gugick
Quest Software
www.imceda.com
www.quest.com|||take a look at connection pooling
http://sqlservercode.blogspot.com/
"newie" wrote:
> We are looking at ways to optimize our process for retrieving primary keys
.
> Currently, we are creating a new database call to get each ID we need. We
> are considering the idea of keeping a database connection open with a sing
le
> responsibility of retrieving a new primary key. Can you provide me a
> response to the following questions?:
> Are there any timeouts on open connections to the database from within SQL
> Server?
> Can you think of negative impacts this could have on the database to have
a
> consistent open connections?
>
Sunday, February 19, 2012
Debugging a worker thread inside SQL Server
Hi Everyone!
Just started looking into Assemblies within SQL Server in the hope of creating a multi-threaded application and when writing a basic test assembly I came across the following problem...
When I create a worker thread within my assembly I am unable to do the following in my newly created thread:
Stop on a breakpoint in VS2005 Use Debug.Writeline to output to the output windowI know the thread is running as I am able to write to the EventLog, but VS2005 seems to be unaware of any thread other than the main SQL server thread.
If anyone could tell me whether there it is possible to debug non-SQL server threads, whether I am doing something wrong, or whether I should be doing things differently that would be great!
Thanks in advance for any help!!
The code is as follows (apologies as its not very well written!):
using System;
using System.Data;
using System.Data.SqlClient;
using System.Data.SqlTypes;
using Microsoft.SqlServer.Server;
using System.Threading;
using System.Diagnostics;
public partial class StoredProcedures
{
/// <summary>
/// This stored procedure starts the comms
/// </summary>
[Microsoft.SqlServer.Server.SqlProcedure]
public static void StartComms()
{
try
{
// Output some debug output to show the thread is running
Debug.WriteLine("Comms is starting");
// Create the thread to run in the main thread class
Thread zThread = new Thread(new ThreadStart(ThreadFunction));
// Start the thread running
zThread.Start();
// Sleep to let the other one run
Thread.Sleep(2000);
// Output some debug output to show the thread is running
Debug.WriteLine("Comms is about to wait for thread to finish");
// Wait for the thread to complete
zThread.Join();
// Output some debug output to show the thread is running
Debug.WriteLine("Comms is ending");
}
catch
{
throw;
}
}
/// <summary>
/// The main thread function
/// </summary>
public static void ThreadFunction()
{
try
{
// Flag to keep thread running
bool bRunning = true;
// While the thread is running
while (bRunning == true)
{
// Output some debug output to show the thread is running
Debug.WriteLine("Thread function running");
System.Diagnostics.EventLog.WriteEntry("SQLServerThreadTest",
"Thread function is running");
// Sleep for two seconds
Thread.Sleep(5000);
}
}
catch
{
throw;
}
}
};
If you start debugging by doing "Attach to Process" and selecting sqlservr.exe before executing your proc then the breakpoint is hit and Debug.Writeline does work in VS as expected.
I've forwarded this thread to the VS guys to see why your bp is not being hit when you start debugging either from a t-sql debug script or by doing "Step Into" your stored procedure.
Steven
|||Hi Steven!
Thanks very much for your response.
I have tried out the "Attach to Process" this morning and by debugging this way everything works as expected - a treat!
If you find out any more information from the VS guys if you could post that for me that would be great, although I am very happy just knowing that there is a way to debug the application that I am going to write.
Thank you very much again for your help!!
Tuesday, February 14, 2012
debug procedure.
CREATE OR REPLACE PROCEDURE get_parts (pizza IN VARCHAR2)
_
BEGIN
SELECT NAME
INTO_ temp_table
FROM pizza_items
WHERE pizza = USED_IN;
END;
iT READS FROM TABLE
CREATE TABLE PIZZA_ITEMS(id NUMBER PRIMARY KEY,
name VARCHAR2(20),
used_in VARCHAR2(20));
CREATE SEQUENCE pizza_sequence START WITH 1001;
And is meant to match the pizza name with the toppings used and place the results into temp_table
CREATE TABLE temp_table(ingredient varchar2(20));
Any ideas?Hi minniemouse,
Would you please post also the compilation error?|||1) You need the keyword IS or AS before BEGIN
2) "SELECT name INTO temp_table" expects to find a VARIABLE called "temp_table", not a table. To insert data into a table requires an INSERT statement.
Try this:
CREATE OR REPLACE PROCEDURE get_parts (pizza IN VARCHAR2)
IS
BEGIN
INSERT INTO temp_table(ingredient)
SELECT NAME
FROM pizza_items
WHERE pizza = USED_IN;
END;
/