Showing posts with label default. Show all posts
Showing posts with label default. Show all posts

Monday, March 26, 2012

Number of worker threads

As far as i know, there are 255 default worker threads. how is it possible to
know the number of threads that are currently consumed.
The 255 is the max by default but that does not mean you are actually using
that many. Have a look at DBCC SQLPERF(UMSSTATS) to see what each scheduler
is using at that time.
Andrew J. Kelly SQL MVP
"Ramesh" <Ramesh@.discussions.microsoft.com> wrote in message
news:C06B0D03-7993-459D-BE4D-71729A7C2A6D@.microsoft.com...
> As far as i know, there are 255 default worker threads. how is it possible
> to
> know the number of threads that are currently consumed.
|||Hi,
Use the OS Performance monitor (Perfmon):-
1. Choose the Performace object "PROCESS"
2. From the counter list select "Thread count"
3. Select the Instance "SQLServr
4. Click 'ADD'
5. See the current running thread value for SQL SERVER IN the status bar of
Perfmon.
Thanks
Hari
SQL Server MVP
"Ramesh" <Ramesh@.discussions.microsoft.com> wrote in message
news:C06B0D03-7993-459D-BE4D-71729A7C2A6D@.microsoft.com...
> As far as i know, there are 255 default worker threads. how is it possible
> to
> know the number of threads that are currently consumed.

Number of worker threads

As far as i know, there are 255 default worker threads. how is it possible to
know the number of threads that are currently consumed.The 255 is the max by default but that does not mean you are actually using
that many. Have a look at DBCC SQLPERF(UMSSTATS) to see what each scheduler
is using at that time.
Andrew J. Kelly SQL MVP
"Ramesh" <Ramesh@.discussions.microsoft.com> wrote in message
news:C06B0D03-7993-459D-BE4D-71729A7C2A6D@.microsoft.com...
> As far as i know, there are 255 default worker threads. how is it possible
> to
> know the number of threads that are currently consumed.|||Hi,
Use the OS Performance monitor (Perfmon):-
1. Choose the Performace object "PROCESS"
2. From the counter list select "Thread count"
3. Select the Instance "SQLServr
4. Click 'ADD'
5. See the current running thread value for SQL SERVER IN the status bar of
Perfmon.
Thanks
Hari
SQL Server MVP
"Ramesh" <Ramesh@.discussions.microsoft.com> wrote in message
news:C06B0D03-7993-459D-BE4D-71729A7C2A6D@.microsoft.com...
> As far as i know, there are 255 default worker threads. how is it possible
> to
> know the number of threads that are currently consumed.

Number of worker threads

As far as i know, there are 255 default worker threads. how is it possible t
o
know the number of threads that are currently consumed.The 255 is the max by default but that does not mean you are actually using
that many. Have a look at DBCC SQLPERF(UMSSTATS) to see what each scheduler
is using at that time.
Andrew J. Kelly SQL MVP
"Ramesh" <Ramesh@.discussions.microsoft.com> wrote in message
news:C06B0D03-7993-459D-BE4D-71729A7C2A6D@.microsoft.com...
> As far as i know, there are 255 default worker threads. how is it possible
> to
> know the number of threads that are currently consumed.|||Hi,
Use the OS Performance monitor (Perfmon):-
1. Choose the Performace object "PROCESS"
2. From the counter list select "Thread count"
3. Select the Instance "SQLServr
4. Click 'ADD'
5. See the current running thread value for SQL SERVER IN the status bar of
Perfmon.
Thanks
Hari
SQL Server MVP
"Ramesh" <Ramesh@.discussions.microsoft.com> wrote in message
news:C06B0D03-7993-459D-BE4D-71729A7C2A6D@.microsoft.com...
> As far as i know, there are 255 default worker threads. how is it possible
> to
> know the number of threads that are currently consumed.

Wednesday, March 21, 2012

number of errorlogs in mssql 7.0

hi,
Is there any setting in mssql 7.0 to change the number of
sqlserver error logs from the default value of 6?
I know for sure - we can change a registry setting for
mssql2000. IS there anything for mssql7.0?
regards,
bharathbharath wrote:
> hi,
> Is there any setting in mssql 7.0 to change the number of
> sqlserver error logs from the default value of 6?
> I know for sure - we can change a registry setting for
> mssql2000. IS there anything for mssql7.0?
> regards,
> bharath
You need to change the registry entry:
HKLM\SOFTWARE\Microsoft\MSSQLServer\MSSQ
LServer
DWORD NumErrorLogs = <xx>
(answered previously by Neil Pike, MVP)
http://groups.google.pl/groups?hl=p...&rnu
m=4
sincerely,
--
Sebastian K. Zaklada
Skilled Software
http://www.skilledsoftware.com
This posting is provided "AS IS" with no warranties, and confers no rights.sql

Friday, March 9, 2012

NullReferenceException from AMO - Connect

Server svr = new Server();

svr.Connect(Properties.Settings.Default.OLAPConnectionString);

(Server is of type Microsoft.AnalysisServices.Server)

Results in:

NullReferenceException: Object reference not set to an instance of an object.

at Microsoft.AnalysisServices.DesignXmlReader.CheckForXmlaException()

at Microsoft.AnalysisServices.DesignXmlReader.ReadRoot(Type type)

at Microsoft.AnalysisServices.DesignXmlReader.DeserializeComponent(IDesignerSerializationManager manager, XmlReader reader, Type root)

at Microsoft.AnalysisServices.JaXmlSerializer.DeserializeComponent(IDesignerSerializationManager manager, XmlReader reader, Type root)

at Microsoft.AnalysisServices.AnalysisServicesClient.Discover(IMajorObject obj, ObjectExpansion expansion)

at Microsoft.AnalysisServices.Server.Refresh(IMajorObject obj, ObjectExpansion expansion)

at Microsoft.AnalysisServices.Server.SendRefresh(IMajorObject obj, ObjectExpansion expansion)

at Microsoft.AnalysisServices.MajorObject.Refresh()

at Microsoft.AnalysisServices.Server.Connect(String connectionString, String sessionId)

at Microsoft.AnalysisServices.Server.Connect(String connectionString)

at ... my code, the call to Connect, above

The connection string is non-null, and names a valid, running SSAS database on the local machine. Any theories? This code has been working fine up till now, and nothing's changed in the cube or the enclosing database in weeks. The only thing of interest that changed recently was a batch of updates from Windows Update - but that seems very unlikely since none of them were SSAS related.

... and, wouldn't you know it, next time through, the code worked fine. The process hasn't even been re-started. I hate bugs that "fix" themselves!

This is typically a result of late bindings. Not necessarily a bug, just a runtime risk.

Adamus

|||Actually, I think the problem was simply that I had VS set to stop on exception throw, instead of stop on unhandled. Second time through, I'd changed the settings. Presumably this exception was thrown, caught and handled inside of AMO and is nothing to worry about.

Wednesday, March 7, 2012

NULL Values vs empty string vs space

How do I define a field to have the default value = ''. Not NULL but not a space either in SQL Server 2005?

Use the following in the field (default value) property

('')

Regards

|||I tried that and it didn't work.|||Just to get your point, did you mean that you want to place a default empty string?|||Smiling is correct, that is how you do it. When you say "it didn't work", perhaps you mean it didn't do what you wanted/expected it to, but that is how you define a default of a zero-length string (from within management studio).|||

That's what I thought too. I tried it again and it does work. I think what was going on is I had the table definition open and saved it but it really did not save. So I closed the defintion window and tried it and it works.

Thanks

|||Whats even more interesting it does NOT work when using the FormView control in ASP.NET 2.0 but if I enter the data directly into the table using the server explorer it does work.

???|||Does it show NULL value though?|||

YES, when viewing the data in the database server explorer the value is NULL even though the default value is ''.

Like I said entering data directly in the server explorer it works, when using a FormView control it does not. When using the formview all code is generated by VisualStudio.

Here is the SQLDatasource code generated by Visual Studio...

<asp:SqlDataSource ID="SqlDataSourceUserProfile" runat="server" ConnectionString="<%$ ConnectionStrings:AEISITConnectionString %>"
DeleteCommand="DELETE FROM [UserProfile] WHERE [UserProfile_RecID] = @.UserProfile_RecID"
InsertCommand="INSERT INTO [UserProfile] ([UserID], [UserRole], [FirstName], [LastName],Email, [CampusID], [DistrictID], [RegionID], [SessionID]) VALUES (@.UserID, @.UserRole, @.FirstName, @.LastName, @.Email, @.CampusID, @.DistrictID, @.RegionID, @.SessionID)"
SelectCommand="SELECT UserProfile_RecID, UserID, UserRole, FirstName, LastName, Email, CampusID, DistrictID, RegionID, SessionID FROM UserProfile WHERE (UserProfile_RecID = @.UserProfile_RecID)"
UpdateCommand="UPDATE [UserProfile] SET [UserID] = @.UserID, [UserRole] = @.UserRole, [FirstName] = @.FirstName, [LastName] = @.LastName,Email = @.Email, [CampusID] = @.CampusID, [DistrictID] = @.DistrictID, [RegionID] = @.RegionID, [SessionID] = @.SessionID WHERE [UserProfile_RecID] = @.UserProfile_RecID">
<DeleteParameters>
<asp:Parameter Name="UserProfile_RecID" Type="Int32" />
</DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="UserID" Type="String" />
<asp:Parameter Name="UserRole" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="CampusID" Type="String" />
<asp:Parameter Name="DistrictID" Type="String" />
<asp:Parameter Name="RegionID" Type="String" />
<asp:Parameter Name="SessionID" Type="String" />
<asp:Parameter Name="UserProfile_RecID" Type="Int32" />
</UpdateParameters>
<SelectParameters>
<asp:ControlParameter ControlID="UserListBox" Name="UserProfile_RecID" PropertyName="SelectedValue"
Type="Int32" />
</SelectParameters>
<InsertParameters>
<asp:Parameter Name="UserID" Type="String" />
<asp:Parameter Name="UserRole" Type="String" />
<asp:Parameter Name="FirstName" Type="String" />
<asp:Parameter Name="LastName" Type="String" />
<asp:Parameter Name="Email" Type="String" />
<asp:Parameter Name="CampusID" Type="String" />
<asp:Parameter Name="DistrictID" Type="String" />
<asp:Parameter Name="RegionID" Type="String" />
<asp:Parameter Name="SessionID" Type="String" />
</InsertParameters>
</asp:SqlDataSource>

|||

That would explain it.

If you want the default value on insert, remove all references to the field in the insertcommand. Alternatively, change the parameter's convertemptystringtonull property to false.

|||

Yes, whatMotley said is correct.

Just change the convertemptystringtonull property to false.

NULL values and Indexes

Someone was explaining me the following:

1- NULL values is NOT good for a column that has an index
2- Therefore, all columns have default values of :
- 0 for numbers
- " " for strings

I honestly can't believe that it's a good idea to have all table columns
be filled with 1-2 space bar characters in order not to leave them
as NULL values.

Am i the only one who is confused about this approach? Is the
person doing this correct or wrong? And not just the columns that
have indexes on, all the columns are being set to ALLOW NULLS and
all of them are set with Default Values of (' ') for text fields and (0)
for
number fields.

Thank youOn Fri, 1 Apr 2005 22:57:23 -0500, "serge" <sergea@.nospam.ehmail.com>
wrote:

>Someone was explaining me the following:
>1- NULL values is NOT good for a column that has an index
>2- Therefore, all columns have default values of :
> - 0 for numbers
> - " " for strings
>I honestly can't believe that it's a good idea to have all table columns
>be filled with 1-2 space bar characters in order not to leave them
>as NULL values.
>Am i the only one who is confused about this approach? Is the
>person doing this correct or wrong? And not just the columns that
>have indexes on, all the columns are being set to ALLOW NULLS and
>all of them are set with Default Values of (' ') for text fields and (0)
>for
>number fields.
>
>Thank you

Time to be blunt here...

You are absolutely right.
You should not be confused at all.

NULL values can be very useful, especially on indexes, as an
indication of "index is not set" or "no index here", or "default
inherited index applies".
I use Null values extensively (in huge database systems) with not
only no problems whatsoever, but measurably signifcant advantages.
People who try to tell you that "Nulls are the work of the devil", or
:the sky will fall down if you allow nulls", or some such
unsubstantiated childish delusion are exclusively ignorant of the
correct ways to handle them.
(Or too lazy/ineducable to learn their correct implementation and/or
benefits.)

Fact, just plain indisputable fact.|||"serge" <sergea@.nospam.ehmail.com> wrote in message
news:EKo3e.24424$w63.1491786@.news20.bellglobal.com ...
> Someone was explaining me the following:
> 1- NULL values is NOT good for a column that has an index
> 2- Therefore, all columns have default values of :
> - 0 for numbers
> - " " for strings
> I honestly can't believe that it's a good idea to have all table columns
> be filled with 1-2 space bar characters in order not to leave them
> as NULL values.

Disk space is cheap, so this is not much of an objection.

> Am i the only one who is confused about this approach? Is the
> person doing this correct or wrong? And not just the columns that
> have indexes on, all the columns are being set to ALLOW NULLS and
> all of them are set with Default Values of (' ') for text fields and (0)
> for
> number fields.

Ultimately the concern is cardinality. If you have lots of NULLs the index
is less useful than an index with fewer NULLs.

Of course if you have lots of 0's or single spaces,the index is less useful.

>
> Thank you|||I don't think it's reasonable to imply that the ideas of people such as
Chris Date are based on ignorance or laziness. There are intelligent
arguments on both sides of the NULL debate.

Serge might want to refer to the works of Date, Darwen and Pascal for
contrary points-of-view on the problems with NULLs.

http://www.amazon.com/exec/obidos/t...0260307-5456631
http://www.dbdebunk.com/publications.html

As for saving a few bytes of storage, of all the reasons to use or not
to use NULLs that's probably the least important in my view.

--
David Portas
SQL Server MVP
--

Monday, February 20, 2012

NULL default for query-based parameter

I'm using DevStudio 2005 with Reporting Services and SQL Server 2005. I have
a report with two parameters - @.StoreID and @.ParkName.
@.StoreID is a "non-queried" parameter with "Allow null value" checked.
@.ParkName is a "From query" parameter with "Allow null value" checked.
"Null" is checked under Default value for both parameters.
The stored procedure behind the report is setup to interpret "NULL" as "all
values" for both parameters, so you could select all stores and all parks, or
one park or one store, etc.
When I run the report, the @.StoreID parameter fields comes up with a NULL
checkbox next to it; that checkbox is checked by default and the parameter
field itself is blank and grayed out. If I uncheck NULL, I can enter a
specific store ID. This is exactly what I expect.
However, the @.ParkName parameter field comes up with "<Select a value>" as a
default and no NULL checkbox. If I leave the "<Select a value>" and click
View Report, I get an error about specifying a value for Park Name. If I
select a specific value from the drop-down-list, it works correctly.
Since both parameters are configured the same way with respect to NULL
values, I expected them to behave the same way (NULL checkbox checked by
default), but they don't. Is this an issue specifically with query-based
parameters? If so, how do I get the query-based parameter @.ParkName to
default to and accept a NULL input the same way @.StoreID does?Hi Mike,
The most common workaround I've found for the problem you are
encountering is to UNION an 'All' entry into the @.Parkname parameter such as
follows.
SELECT DISTINCT 1 as Sort, ParkName FROM Parks
UNION ALL
SELECT 0, 'All'
Order By Sort
You then also have to configure your dataset WHERE to have an entry that
includes
WHERE Parkaname in (@.ParkName) OR 'All' in (@.ParkName)
Michael C
"Mike Miller" wrote:
> I'm using DevStudio 2005 with Reporting Services and SQL Server 2005. I have
> a report with two parameters - @.StoreID and @.ParkName.
> @.StoreID is a "non-queried" parameter with "Allow null value" checked.
> @.ParkName is a "From query" parameter with "Allow null value" checked.
> "Null" is checked under Default value for both parameters.
> The stored procedure behind the report is setup to interpret "NULL" as "all
> values" for both parameters, so you could select all stores and all parks, or
> one park or one store, etc.
> When I run the report, the @.StoreID parameter fields comes up with a NULL
> checkbox next to it; that checkbox is checked by default and the parameter
> field itself is blank and grayed out. If I uncheck NULL, I can enter a
> specific store ID. This is exactly what I expect.
> However, the @.ParkName parameter field comes up with "<Select a value>" as a
> default and no NULL checkbox. If I leave the "<Select a value>" and click
> View Report, I get an error about specifying a value for Park Name. If I
> select a specific value from the drop-down-list, it works correctly.
> Since both parameters are configured the same way with respect to NULL
> values, I expected them to behave the same way (NULL checkbox checked by
> default), but they don't. Is this an issue specifically with query-based
> parameters? If so, how do I get the query-based parameter @.ParkName to
> default to and accept a NULL input the same way @.StoreID does?|||Michael,
Thanks for the tip. I had considered that previously, but was hoping there
was a simpler solution. It seems strange that Reporting Services treats a
non-queried parameter differently than a queried parameter with respect to
NULL values.
Mike
"Michael C" wrote:
> Hi Mike,
> The most common workaround I've found for the problem you are
> encountering is to UNION an 'All' entry into the @.Parkname parameter such as
> follows.
> SELECT DISTINCT 1 as Sort, ParkName FROM Parks
> UNION ALL
> SELECT 0, 'All'
> Order By Sort
> You then also have to configure your dataset WHERE to have an entry that
> includes
> WHERE Parkaname in (@.ParkName) OR 'All' in (@.ParkName)
> Michael C
> "Mike Miller" wrote:
> > I'm using DevStudio 2005 with Reporting Services and SQL Server 2005. I have
> > a report with two parameters - @.StoreID and @.ParkName.
> >
> > @.StoreID is a "non-queried" parameter with "Allow null value" checked.
> > @.ParkName is a "From query" parameter with "Allow null value" checked.
> > "Null" is checked under Default value for both parameters.
> > The stored procedure behind the report is setup to interpret "NULL" as "all
> > values" for both parameters, so you could select all stores and all parks, or
> > one park or one store, etc.
> >
> > When I run the report, the @.StoreID parameter fields comes up with a NULL
> > checkbox next to it; that checkbox is checked by default and the parameter
> > field itself is blank and grayed out. If I uncheck NULL, I can enter a
> > specific store ID. This is exactly what I expect.
> >
> > However, the @.ParkName parameter field comes up with "<Select a value>" as a
> > default and no NULL checkbox. If I leave the "<Select a value>" and click
> > View Report, I get an error about specifying a value for Park Name. If I
> > select a specific value from the drop-down-list, it works correctly.
> >
> > Since both parameters are configured the same way with respect to NULL
> > values, I expected them to behave the same way (NULL checkbox checked by
> > default), but they don't. Is this an issue specifically with query-based
> > parameters? If so, how do I get the query-based parameter @.ParkName to
> > default to and accept a NULL input the same way @.StoreID does?