Showing posts with label asp. Show all posts
Showing posts with label asp. Show all posts

Wednesday, March 28, 2012

Profile, SQLDataSource and GridView

Hello.

When I create a user at the ASP.NET database, I need to insert more fields than the defaults, and I do it like this:

Dim customProfile As ProfileCommon = ProfileCommon.Create(CreateUserWizard1.UserName, True)

customProfile.telephone =(CType(CreateUserWizard1.CreateUserStep.ContentTemplateContainer.FindControl("TelephoneText"),TextBox)).Text
(telephone example)


Those data are inserted at the DB at the aspnet_Profile table, in the fields PropertyNames & PropertyValuesString, but they are saved together (see image above)


I want to separate those properties in the GridView as long as each property appears in a column, is it possible?Tongue Tied
Thank you very much, i'm expecting your answers.

If you want an additional column you could change existing TSQL
SELECT A, B, C FROM TABLE
to
SELECT A, B, C, '' AS D FROM TABLE

|||

I want to separate these properties in columns, not to create a new empty column.

|||Regrettably you published an image - please publish the text that you need split and I will write some TSQL for you.|||

GridView shows me this:

GridView bad

and I need this:


|||Please copy out the text and post that. The image is useless to me.|||

The text is the following:

<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" CellPadding="4" CssClass="gridview" DataSourceID="SqlDataSource1"
ForeColor="#333333" GridLines="None">
<FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<Columns>
<asp:BoundField DataField="UserName" HeaderText="ID" SortExpression="UserName" />
<asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
<asp:BoundField DataField="PropertyNames" HeaderText="Propiedades" SortExpression="PropertyNames" />
<asp:BoundField DataField="PropertyValuesString" HeaderText="Valores" SortExpression="PropertyValuesString" />
</Columns>
<RowStyle BackColor="#EFF3FB" />
<EditRowStyle BackColor="#2461BF" />
<SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
<PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
<HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
<AlternatingRowStyle BackColor="White" />
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\webfax.mdf;Integrated Security=True;User Instance=True"
ProviderName="System.Data.SqlClient" SelectCommand="SELECT aspnet_Membership.Email, aspnet_Profile.PropertyNames, aspnet_Profile.PropertyValuesString, aspnet_Users.UserName FROM aspnet_Membership INNER JOIN aspnet_Profile ON aspnet_Membership.UserId = aspnet_Profile.UserId INNER JOIN aspnet_Users ON aspnet_Membership.UserId = aspnet_Users.UserId">
</asp:SqlDataSource>

|||Thank you for posting the program source. However what I need is the text of the displayed field that needs to sub-divided. I can then modifySELECT aspnet_Membership.Email, aspnet_Profile.PropertyNames,aspnet_Profile.PropertyValuesString, aspnet_Users.UserName FROMaspnet_Membership INNER JOIN aspnet_Profile ON aspnet_Membership.UserId= aspnet_Profile.UserId INNER JOIN aspnet_Users ONaspnet_Membership.UserId = aspnet_Users.UserIdto bsub-divide the fields.|||

ok, both texts are:

empresa:S:0:3:nombre:S:3:10:telefono:s:13:5:apellidos:S:18:12:

and

UBuLa cartera45678que yo tengo


these are for the first case, for the second case:

empresa:S:0:3:nombre:S:3:8:telefono:S:11:5:apellidos:S:16:13

and

453el huevo76534de la gallina

thanks

|||

Presumably you need
empresa:S:0:3:nombre:S:3:10:telefono:s:13:5:apellidos:S:18:12:

broken down to
empresa:S:0:3:
nombre:S:3:10:
telefono:s:13:5:
apellidos:S:18:12:

using the delimiters I have marked in bold

|||

Based on the presumption in my previous post

DECLARE @.VAR VARCHAR(100)
DECLARE @.EMPRESSA VARCHAR(100)
DECLARE @.NOMBRE VARCHAR(100)
DECLARE @.telefono VARCHAR(100)
DECLARE @.apellidos VARCHAR(100)
SET @.VAR = 'empresa:S:0:3:nombre:S:3:10:telefono:s:13:5:apellidos:S:18:12:'
PRINT @.VAR
--empresa:S:0:3:
--nombre:S:3:10:
--telefono:s:13:5:
--apellidos:S:18:12:
DECLARE @.IMARK1 INT
DECLARE @.IMARK2 INT
SET @.IMARK1 = CHARINDEX('nombre:', @.VAR)
PRINT @.IMARK1
IF @.IMARK1 > 0 BEGIN
SET @.EMPRESSA = SUBSTRING(@.VAR, 1, @.IMARK1-1)
PRINT '@.EMPRESSA [' + @.EMPRESSA + ']'
END
SET @.IMARK1 = CHARINDEX('apellidos:', @.VAR)
IF @.IMARK1 > 0 BEGIN
SET @.apellidos = SUBSTRING(@.VAR, @.IMARK1,DATALENGTH(@.VAR))
PRINT '@.apellidos [' + @.apellidos + ']'
END
SET @.IMARK1 = CHARINDEX('apellidos:', @.VAR)
SET @.IMARK2 = CHARINDEX('telefono:', @.VAR)
IF @.IMARK1 > 0 AND @.IMARK2 > 0 AND @.IMARK1 > @.IMARK2 BEGIN
SET @.telefono = SUBSTRING(@.VAR, @.IMARK2,@.IMARK1 - @.IMARK2)
PRINT '@.telefono [' + @.telefono + ']'
END
SET @.IMARK1 = CHARINDEX('telefono:', @.VAR)
SET @.IMARK2 = CHARINDEX('nombre:', @.VAR)
IF @.IMARK1 > 0 AND @.IMARK2 > 0 AND @.IMARK1 > @.IMARK2 BEGIN
SET @.nombre = SUBSTRING(@.VAR, @.IMARK2,@.IMARK1 - @.IMARK2)
PRINT '@.nombre [' + @.nombre + ']'
END

gives

empresa:S:0:3:nombre:S:3:10:telefono:s:13:5:apellidos:S:18:12:
15
@.EMPRESSA [empresa:S:0:3:]
@.apellidos [apellidos:S:18:12:]
@.telefono [telefono:s:13:5:]
@.nombre [nombre:S:3:10:]

The TSQL will need to be wrapped in in some scalar functions

|||

The functions

CREATE FUNCTION dbo.fnGetApellidos (@.VAR VARCHAR(250))
RETURNS VARCHAR(50) AS
BEGIN
DECLARE @.RETURN VARCHAR(50)
DECLARE @.IMARK1 INT
DECLARE @.IMARK2 INT
SET @.IMARK1 = CHARINDEX('apellidos:', @.VAR)
IF @.IMARK1 > 0 BEGIN
SET @.RETURN = SUBSTRING(@.VAR, @.IMARK1,DATALENGTH(@.VAR))
--PRINT '@.apellidos [' + @.RETURN + ']'
END
RETURN @.RETURN
END
GO
CREATE FUNCTION dbo.fnGetEMPRESSA (@.VAR VARCHAR(250))
RETURNS VARCHAR(50) AS
BEGIN
DECLARE @.RETURN VARCHAR(50)
DECLARE @.IMARK1 INT
DECLARE @.IMARK2 INT
SET @.IMARK1 = CHARINDEX('nombre:', @.VAR)
--PRINT @.IMARK1
IF @.IMARK1 > 0 BEGIN
SET @.RETURN = SUBSTRING(@.VAR, 1, @.IMARK1-1)
--PRINT '@.EMPRESSA [' + @.RETURN + ']'
END
RETURN @.RETURN
END
GO
CREATE FUNCTION dbo.fnGetTelefono (@.VAR VARCHAR(250))
RETURNS VARCHAR(50) AS
BEGIN
DECLARE @.RETURN VARCHAR(50)
DECLARE @.IMARK1 INT
DECLARE @.IMARK2 INT
SET @.IMARK1 = CHARINDEX('apellidos:', @.VAR)
SET @.IMARK2 = CHARINDEX('telefono:', @.VAR)
IF @.IMARK1 > 0 AND @.IMARK2 > 0 AND @.IMARK1 > @.IMARK2 BEGIN
SET @.RETURN = SUBSTRING(@.VAR, @.IMARK2,@.IMARK1 - @.IMARK2)
--PRINT '@.telefono [' + @.RETURN + ']'
END
RETURN @.RETURN
END
GO
CREATE FUNCTION dbo.fnGetNombre (@.VAR VARCHAR(250))
RETURNS VARCHAR(50) AS
BEGIN
DECLARE @.RETURN VARCHAR(50)
DECLARE @.IMARK1 INT
DECLARE @.IMARK2 INT
SET @.IMARK1 = CHARINDEX('telefono:', @.VAR)
SET @.IMARK2 = CHARINDEX('nombre:', @.VAR)
IF @.IMARK1 > 0 AND @.IMARK2 > 0 AND @.IMARK1 > @.IMARK2 BEGIN
SET @.RETURN = SUBSTRING(@.VAR, @.IMARK2,@.IMARK1 - @.IMARK2)
--PRINT '@.nombre [' + @.RETURN + ']'
END
RETURN @.RETURN
END
GO

When run by
DECLARE @.VAR VARCHAR(100)
SET @.VAR = 'empresa:S:0:3:nombre:S:3:10:telefono:s:13:5:apellidos:S:18:12:'
PRINT @.VAR
PRINT dbo.fnGetEmpressa(@.VAR)
PRINT dbo.fnGetNombre(@.VAR)
PRINT dbo.fnGetTelefono(@.VAR)
PRINT dbo.fnGetApellidos(@.VAR)

give
empresa:S:0:3:nombre:S:3:10:telefono:s:13:5:apellidos:S:18:12:
empresa:S:0:3:
nombre:S:3:10:
telefono:s:13:5:
apellidos:S:18:12:

Thus instead of
SELECT VAR FROM TABLENAME

you can have
SELECT dbo.fnGetEmpressa(VAR) ASEmpressa,dbo.fnGetNombre(VAR) ASNombre,
dbo.fnGetTelefono(VAR) ASTelefono,dbo.fnGetApellidos(VAR) ASApellidos FROM TABLENAME

this giving you the required split on columns

sql

Wednesday, March 21, 2012

Processor License

I read the FAQ at
http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
not clear to me how to buy processor licenses basing on the number of
processors
The FAQ states
"If any processor in the server is made inaccessible to all of the
operating system copies set up to run SQL Server, then that processor
does not require a Processor license for SQL Server. In other words, a
SQL Server Processor license is required for each processor that is
accessible to any operating system copy on which SQL Server is set up
to run. "
Does this mean that the only way to avoid buying multiple processor
licenses is disabling the processor from the server's BIOS?
I guess that the "processor control" tab in the SQL server properties
has nothing to do with this, even if I'd find it very wise if MS
provided us with such a tool...
I also guess that they mean physical processor AND NOT virtual
processor deriving from Hyperthreading...
Thanks
Dave
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
That is how I understand it.

> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
Yep
Keith
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegr oups.com...
> I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>
|||Hi,
Of course per processor licence is for physical processor and not for
Hyperthreading.
As regards disabling is as far as I know exactly as you wrote. You have to
disable processor in BIOS otherwise you should buy a licence.
Danijel
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegr oups.com...
>I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>
|||Disabling in BIOS or physically removing a processor is the only way to keep
from counting a processor towards licensing requirements. If the OS sees
it, you must license it.
"Processors" means physical processors, not logical processors. Turning
HyperThreading on or off has no effect on licensing requirements.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegr oups.com...
> I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>

Processor License

I read the FAQ at
http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
not clear to me how to buy processor licenses basing on the number of
processors
The FAQ states
"If any processor in the server is made inaccessible to all of the
operating system copies set up to run SQL Server, then that processor
does not require a Processor license for SQL Server. In other words, a
SQL Server Processor license is required for each processor that is
accessible to any operating system copy on which SQL Server is set up
to run. "
Does this mean that the only way to avoid buying multiple processor
licenses is disabling the processor from the server's BIOS?
I guess that the "processor control" tab in the SQL server properties
has nothing to do with this, even if I'd find it very wise if MS
provided us with such a tool...
I also guess that they mean physical processor AND NOT virtual
processor deriving from Hyperthreading...
Thanks
DaveHi,
Of course per processor licence is for physical processor and not for
Hyperthreading.
As regards disabling is as far as I know exactly as you wrote. You have to
disable processor in BIOS otherwise you should buy a licence.
Danijel
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegroups.com...
>I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>|||> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
That is how I understand it.
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
Yep
--
Keith
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegroups.com...
> I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>|||Disabling in BIOS or physically removing a processor is the only way to keep
from counting a processor towards licensing requirements. If the OS sees
it, you must license it.
"Processors" means physical processors, not logical processors. Turning
HyperThreading on or off has no effect on licensing requirements.
--
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegroups.com...
> I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>

Processor License

I read the FAQ at
http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
not clear to me how to buy processor licenses basing on the number of
processors
The FAQ states
"If any processor in the server is made inaccessible to all of the
operating system copies set up to run SQL Server, then that processor
does not require a Processor license for SQL Server. In other words, a
SQL Server Processor license is required for each processor that is
accessible to any operating system copy on which SQL Server is set up
to run. "
Does this mean that the only way to avoid buying multiple processor
licenses is disabling the processor from the server's BIOS?
I guess that the "processor control" tab in the SQL server properties
has nothing to do with this, even if I'd find it very wise if MS
provided us with such a tool...
I also guess that they mean physical processor AND NOT virtual
processor deriving from Hyperthreading...
Thanks
Dave> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
That is how I understand it.

> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
Yep
Keith
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegroups.com...
> I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>|||Hi,
Of course per processor licence is for physical processor and not for
Hyperthreading.
As regards disabling is as far as I know exactly as you wrote. You have to
disable processor in BIOS otherwise you should buy a licence.
Danijel
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegroups.com...
>I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>|||Disabling in BIOS or physically removing a processor is the only way to keep
from counting a processor towards licensing requirements. If the OS sees
it, you must license it.
"Processors" means physical processors, not logical processors. Turning
HyperThreading on or off has no effect on licensing requirements.
Geoff N. Hiten
Microsoft SQL Server MVP
Senior Database Administrator
Careerbuilder.com
I support the Professional Association for SQL Server
www.sqlpass.org
<dbwmn2001@.yahoo.com> wrote in message
news:1106241266.515795.105740@.c13g2000cwb.googlegroups.com...
> I read the FAQ at
> http://www.microsoft.com/sql/howtobuy/partitioning.asp, but it is still
> not clear to me how to buy processor licenses basing on the number of
> processors
> The FAQ states
> "If any processor in the server is made inaccessible to all of the
> operating system copies set up to run SQL Server, then that processor
> does not require a Processor license for SQL Server. In other words, a
> SQL Server Processor license is required for each processor that is
> accessible to any operating system copy on which SQL Server is set up
> to run. "
> Does this mean that the only way to avoid buying multiple processor
> licenses is disabling the processor from the server's BIOS?
> I guess that the "processor control" tab in the SQL server properties
> has nothing to do with this, even if I'd find it very wise if MS
> provided us with such a tool...
> I also guess that they mean physical processor AND NOT virtual
> processor deriving from Hyperthreading...
> Thanks
> Dave
>sql

Monday, March 12, 2012

Processes seen in enterprise manager

Hi,
We are using a new third party application that has SQL Server 2000 as the
database. It is an ASP page front end and uses ODBC to connect. There are
about 20 people who use it during the day. When I look in EM at the
processes there are well over 100. Even in the morning after everyone has
logged out the night before. All the processes are sleeping so they aren't
using any resources. I feel kind of dumb here but is there a server
property setting where I can set a value for these to expire? Looked in BOL
and in my other books but this doesn't seem to be available. Only timeout
settings when waiting for a connection or running a query. I wasn't worried
about these thinking SQL Server was managing them but then I noticed that
our in house application that uses the same type of setup doesn't have this
problem.
Thanks,
Wayne
I have worked with one third party application whose idea of connection
pooling was to open up 100 connections on start-up, even though it never
used more than 2 during the time we used it. Your third party application
might have been designed by a similarly brilliant and knowledgeable
developer.
You can't set a timeout for the connections, but you can schedule a job to
run the following script on a regular basis. This example kills all
connections that have not been used for 6 hours:
DECLARE @.sql varchar(4000)
WHILE 1=1
BEGIN
SET @.sql = (SELECT TOP 1 'KILL ' + CAST(spid AS VARCHAR(10))
FROM master.dbo.sysprocesses WHERE DATEDIFF(hh, last_batch,
GETDATE()) >= 6
AND spid <> @.@.spid AND spid >= 50)
IF @.sql IS NULL BREAK
EXEC (@.sql)
END
Jacco Schalkwijk
SQL Server MVP
"Wayne Antinore" <wantinore@.veramark.com> wrote in message
news:OPecmwqLEHA.1340@.TK2MSFTNGP12.phx.gbl...
> Hi,
> We are using a new third party application that has SQL Server 2000 as the
> database. It is an ASP page front end and uses ODBC to connect. There
are
> about 20 people who use it during the day. When I look in EM at the
> processes there are well over 100. Even in the morning after everyone has
> logged out the night before. All the processes are sleeping so they
aren't
> using any resources. I feel kind of dumb here but is there a server
> property setting where I can set a value for these to expire? Looked in
BOL
> and in my other books but this doesn't seem to be available. Only timeout
> settings when waiting for a connection or running a query. I wasn't
worried
> about these thinking SQL Server was managing them but then I noticed that
> our in house application that uses the same type of setup doesn't have
this
> problem.
> Thanks,
> Wayne
>
|||Thanks Jacco,
I'll give the script a try. Based on other things I've seen with this app I
would not be surprised if they are doing something similar.
Thanks again,
Wayne
"Jacco Schalkwijk" <NOSPAMjaccos@.eurostop.co.uk> wrote in message
news:%23m6mO%23qLEHA.3516@.TK2MSFTNGP11.phx.gbl...[vbcol=seagreen]
> I have worked with one third party application whose idea of connection
> pooling was to open up 100 connections on start-up, even though it never
> used more than 2 during the time we used it. Your third party application
> might have been designed by a similarly brilliant and knowledgeable
> developer.
> You can't set a timeout for the connections, but you can schedule a job to
> run the following script on a regular basis. This example kills all
> connections that have not been used for 6 hours:
> DECLARE @.sql varchar(4000)
> WHILE 1=1
> BEGIN
> SET @.sql = (SELECT TOP 1 'KILL ' + CAST(spid AS VARCHAR(10))
> FROM master.dbo.sysprocesses WHERE DATEDIFF(hh, last_batch,
> GETDATE()) >= 6
> AND spid <> @.@.spid AND spid >= 50)
> IF @.sql IS NULL BREAK
> EXEC (@.sql)
> END
>
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Wayne Antinore" <wantinore@.veramark.com> wrote in message
> news:OPecmwqLEHA.1340@.TK2MSFTNGP12.phx.gbl...
the[vbcol=seagreen]
> are
has[vbcol=seagreen]
> aren't
> BOL
timeout[vbcol=seagreen]
> worried
that
> this
>
|||Ok, don't be surprised though if the application either fails to work when
it's 100 or so connections aren't there, or just recreates them on a regular
basis after you have killed them....
Jacco Schalkwijk
SQL Server MVP
"Wayne Antinore" <wantinore@.veramark.com> wrote in message
news:uJQkvJrLEHA.3904@.TK2MSFTNGP09.phx.gbl...
> Thanks Jacco,
> I'll give the script a try. Based on other things I've seen with this app
I[vbcol=seagreen]
> would not be surprised if they are doing something similar.
> Thanks again,
> Wayne
>
> "Jacco Schalkwijk" <NOSPAMjaccos@.eurostop.co.uk> wrote in message
> news:%23m6mO%23qLEHA.3516@.TK2MSFTNGP11.phx.gbl...
application[vbcol=seagreen]
to[vbcol=seagreen]
> the
There[vbcol=seagreen]
> has
in
> timeout
> that
>

Friday, March 9, 2012

Processes seen in enterprise manager

Hi,
We are using a new third party application that has SQL Server 2000 as the
database. It is an ASP page front end and uses ODBC to connect. There are
about 20 people who use it during the day. When I look in EM at the
processes there are well over 100. Even in the morning after everyone has
logged out the night before. All the processes are sleeping so they aren't
using any resources. I feel kind of dumb here but is there a server
property setting where I can set a value for these to expire? Looked in BOL
and in my other books but this doesn't seem to be available. Only timeout
settings when waiting for a connection or running a query. I wasn't worried
about these thinking SQL Server was managing them but then I noticed that
our in house application that uses the same type of setup doesn't have this
problem.
Thanks,
WayneI have worked with one third party application whose idea of connection
pooling was to open up 100 connections on start-up, even though it never
used more than 2 during the time we used it. Your third party application
might have been designed by a similarly brilliant and knowledgeable
developer.
You can't set a timeout for the connections, but you can schedule a job to
run the following script on a regular basis. This example kills all
connections that have not been used for 6 hours:
DECLARE @.sql varchar(4000)
WHILE 1=1
BEGIN
SET @.sql = (SELECT TOP 1 'KILL ' + CAST(spid AS VARCHAR(10))
FROM master.dbo.sysprocesses WHERE DATEDIFF(hh, last_batch,
GETDATE()) >= 6
AND spid <> @.@.spid AND spid >= 50)
IF @.sql IS NULL BREAK
EXEC (@.sql)
END
Jacco Schalkwijk
SQL Server MVP
"Wayne Antinore" <wantinore@.veramark.com> wrote in message
news:OPecmwqLEHA.1340@.TK2MSFTNGP12.phx.gbl...
> Hi,
> We are using a new third party application that has SQL Server 2000 as the
> database. It is an ASP page front end and uses ODBC to connect. There
are
> about 20 people who use it during the day. When I look in EM at the
> processes there are well over 100. Even in the morning after everyone has
> logged out the night before. All the processes are sleeping so they
aren't
> using any resources. I feel kind of dumb here but is there a server
> property setting where I can set a value for these to expire? Looked in
BOL
> and in my other books but this doesn't seem to be available. Only timeout
> settings when waiting for a connection or running a query. I wasn't
worried
> about these thinking SQL Server was managing them but then I noticed that
> our in house application that uses the same type of setup doesn't have
this
> problem.
> Thanks,
> Wayne
>|||Thanks Jacco,
I'll give the script a try. Based on other things I've seen with this app I
would not be surprised if they are doing something similar.
Thanks again,
Wayne
"Jacco Schalkwijk" <NOSPAMjaccos@.eurostop.co.uk> wrote in message
news:%23m6mO%23qLEHA.3516@.TK2MSFTNGP11.phx.gbl...
> I have worked with one third party application whose idea of connection
> pooling was to open up 100 connections on start-up, even though it never
> used more than 2 during the time we used it. Your third party application
> might have been designed by a similarly brilliant and knowledgeable
> developer.
> You can't set a timeout for the connections, but you can schedule a job to
> run the following script on a regular basis. This example kills all
> connections that have not been used for 6 hours:
> DECLARE @.sql varchar(4000)
> WHILE 1=1
> BEGIN
> SET @.sql = (SELECT TOP 1 'KILL ' + CAST(spid AS VARCHAR(10))
> FROM master.dbo.sysprocesses WHERE DATEDIFF(hh, last_batch,
> GETDATE()) >= 6
> AND spid <> @.@.spid AND spid >= 50)
> IF @.sql IS NULL BREAK
> EXEC (@.sql)
> END
>
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Wayne Antinore" <wantinore@.veramark.com> wrote in message
> news:OPecmwqLEHA.1340@.TK2MSFTNGP12.phx.gbl...
the[vbcol=seagreen]
> are
has[vbcol=seagreen]
> aren't
> BOL
timeout[vbcol=seagreen]
> worried
that[vbcol=seagreen]
> this
>|||Ok, don't be surprised though if the application either fails to work when
it's 100 or so connections aren't there, or just recreates them on a regular
basis after you have killed them....
Jacco Schalkwijk
SQL Server MVP
"Wayne Antinore" <wantinore@.veramark.com> wrote in message
news:uJQkvJrLEHA.3904@.TK2MSFTNGP09.phx.gbl...
> Thanks Jacco,
> I'll give the script a try. Based on other things I've seen with this app
I
> would not be surprised if they are doing something similar.
> Thanks again,
> Wayne
>
> "Jacco Schalkwijk" <NOSPAMjaccos@.eurostop.co.uk> wrote in message
> news:%23m6mO%23qLEHA.3516@.TK2MSFTNGP11.phx.gbl...
application[vbcol=seagreen]
to[vbcol=seagreen]
> the
There[vbcol=seagreen]
> has
in[vbcol=seagreen]
> timeout
> that
>

Processes seen in enterprise manager

Hi,
We are using a new third party application that has SQL Server 2000 as the
database. It is an ASP page front end and uses ODBC to connect. There are
about 20 people who use it during the day. When I look in EM at the
processes there are well over 100. Even in the morning after everyone has
logged out the night before. All the processes are sleeping so they aren't
using any resources. I feel kind of dumb here but is there a server
property setting where I can set a value for these to expire? Looked in BOL
and in my other books but this doesn't seem to be available. Only timeout
settings when waiting for a connection or running a query. I wasn't worried
about these thinking SQL Server was managing them but then I noticed that
our in house application that uses the same type of setup doesn't have this
problem.
Thanks,
WayneI have worked with one third party application whose idea of connection
pooling was to open up 100 connections on start-up, even though it never
used more than 2 during the time we used it. Your third party application
might have been designed by a similarly brilliant and knowledgeable
developer.
You can't set a timeout for the connections, but you can schedule a job to
run the following script on a regular basis. This example kills all
connections that have not been used for 6 hours:
DECLARE @.sql varchar(4000)
WHILE 1=1
BEGIN
SET @.sql = (SELECT TOP 1 'KILL ' + CAST(spid AS VARCHAR(10))
FROM master.dbo.sysprocesses WHERE DATEDIFF(hh, last_batch,
GETDATE()) >= 6
AND spid <> @.@.spid AND spid >= 50)
IF @.sql IS NULL BREAK
EXEC (@.sql)
END
Jacco Schalkwijk
SQL Server MVP
"Wayne Antinore" <wantinore@.veramark.com> wrote in message
news:OPecmwqLEHA.1340@.TK2MSFTNGP12.phx.gbl...
> Hi,
> We are using a new third party application that has SQL Server 2000 as the
> database. It is an ASP page front end and uses ODBC to connect. There
are
> about 20 people who use it during the day. When I look in EM at the
> processes there are well over 100. Even in the morning after everyone has
> logged out the night before. All the processes are sleeping so they
aren't
> using any resources. I feel kind of dumb here but is there a server
> property setting where I can set a value for these to expire? Looked in
BOL
> and in my other books but this doesn't seem to be available. Only timeout
> settings when waiting for a connection or running a query. I wasn't
worried
> about these thinking SQL Server was managing them but then I noticed that
> our in house application that uses the same type of setup doesn't have
this
> problem.
> Thanks,
> Wayne
>|||Thanks Jacco,
I'll give the script a try. Based on other things I've seen with this app I
would not be surprised if they are doing something similar.
Thanks again,
Wayne
"Jacco Schalkwijk" <NOSPAMjaccos@.eurostop.co.uk> wrote in message
news:%23m6mO%23qLEHA.3516@.TK2MSFTNGP11.phx.gbl...
> I have worked with one third party application whose idea of connection
> pooling was to open up 100 connections on start-up, even though it never
> used more than 2 during the time we used it. Your third party application
> might have been designed by a similarly brilliant and knowledgeable
> developer.
> You can't set a timeout for the connections, but you can schedule a job to
> run the following script on a regular basis. This example kills all
> connections that have not been used for 6 hours:
> DECLARE @.sql varchar(4000)
> WHILE 1=1
> BEGIN
> SET @.sql = (SELECT TOP 1 'KILL ' + CAST(spid AS VARCHAR(10))
> FROM master.dbo.sysprocesses WHERE DATEDIFF(hh, last_batch,
> GETDATE()) >= 6
> AND spid <> @.@.spid AND spid >= 50)
> IF @.sql IS NULL BREAK
> EXEC (@.sql)
> END
>
> --
> Jacco Schalkwijk
> SQL Server MVP
>
> "Wayne Antinore" <wantinore@.veramark.com> wrote in message
> news:OPecmwqLEHA.1340@.TK2MSFTNGP12.phx.gbl...
> > Hi,
> > We are using a new third party application that has SQL Server 2000 as
the
> > database. It is an ASP page front end and uses ODBC to connect. There
> are
> > about 20 people who use it during the day. When I look in EM at the
> > processes there are well over 100. Even in the morning after everyone
has
> > logged out the night before. All the processes are sleeping so they
> aren't
> > using any resources. I feel kind of dumb here but is there a server
> > property setting where I can set a value for these to expire? Looked in
> BOL
> > and in my other books but this doesn't seem to be available. Only
timeout
> > settings when waiting for a connection or running a query. I wasn't
> worried
> > about these thinking SQL Server was managing them but then I noticed
that
> > our in house application that uses the same type of setup doesn't have
> this
> > problem.
> >
> > Thanks,
> > Wayne
> >
> >
>|||Ok, don't be surprised though if the application either fails to work when
it's 100 or so connections aren't there, or just recreates them on a regular
basis after you have killed them....
--
Jacco Schalkwijk
SQL Server MVP
"Wayne Antinore" <wantinore@.veramark.com> wrote in message
news:uJQkvJrLEHA.3904@.TK2MSFTNGP09.phx.gbl...
> Thanks Jacco,
> I'll give the script a try. Based on other things I've seen with this app
I
> would not be surprised if they are doing something similar.
> Thanks again,
> Wayne
>
> "Jacco Schalkwijk" <NOSPAMjaccos@.eurostop.co.uk> wrote in message
> news:%23m6mO%23qLEHA.3516@.TK2MSFTNGP11.phx.gbl...
> > I have worked with one third party application whose idea of connection
> > pooling was to open up 100 connections on start-up, even though it never
> > used more than 2 during the time we used it. Your third party
application
> > might have been designed by a similarly brilliant and knowledgeable
> > developer.
> >
> > You can't set a timeout for the connections, but you can schedule a job
to
> > run the following script on a regular basis. This example kills all
> > connections that have not been used for 6 hours:
> >
> > DECLARE @.sql varchar(4000)
> > WHILE 1=1
> > BEGIN
> > SET @.sql = (SELECT TOP 1 'KILL ' + CAST(spid AS VARCHAR(10))
> > FROM master.dbo.sysprocesses WHERE DATEDIFF(hh, last_batch,
> > GETDATE()) >= 6
> > AND spid <> @.@.spid AND spid >= 50)
> > IF @.sql IS NULL BREAK
> > EXEC (@.sql)
> > END
> >
> >
> > --
> > Jacco Schalkwijk
> > SQL Server MVP
> >
> >
> > "Wayne Antinore" <wantinore@.veramark.com> wrote in message
> > news:OPecmwqLEHA.1340@.TK2MSFTNGP12.phx.gbl...
> > > Hi,
> > > We are using a new third party application that has SQL Server 2000 as
> the
> > > database. It is an ASP page front end and uses ODBC to connect.
There
> > are
> > > about 20 people who use it during the day. When I look in EM at the
> > > processes there are well over 100. Even in the morning after everyone
> has
> > > logged out the night before. All the processes are sleeping so they
> > aren't
> > > using any resources. I feel kind of dumb here but is there a server
> > > property setting where I can set a value for these to expire? Looked
in
> > BOL
> > > and in my other books but this doesn't seem to be available. Only
> timeout
> > > settings when waiting for a connection or running a query. I wasn't
> > worried
> > > about these thinking SQL Server was managing them but then I noticed
> that
> > > our in house application that uses the same type of setup doesn't have
> > this
> > > problem.
> > >
> > > Thanks,
> > > Wayne
> > >
> > >
> >
> >
>

Process SQL Transactions? Easy Question :)

Hi,

Environment - VB.NET, ASP.NET, SQL Server 2000.

In SQL 2000, I am sending an XML, which carries data for two tables. Let's say, I am inserting half of the fields in TABLE1 and rest in TABLE2.

Specifically, I want to use Transaction Processing for inserting the rows in both tables. If insertion in one table fails, any inserted data should ROLLBACK and come out of procedure with relevant error code.

Please advice or send me any example links. Thanks

PankajHave you looked at the Begin Tansaction examples in the BOL? That contains an example with the commit transaction but not rollback transaction. I'm assuming you'll do the inserts in one SP. If that's true then you can follow those examples to help do your inserts and then test for errors and rollback if errors are encountered. Something like
SP...

BEGIN TRANSACTION
Insert code here

IF @.@.Error <> 0
ROLLBACK TRANS
ELSE
COMMIT TRANS

That's a rough idea but hopefully will get you started.