Showing posts with label user. Show all posts
Showing posts with label user. Show all posts

Friday, March 30, 2012

Numerous Login failed for user 'sa' entries in the event viewer

Hello,
We have a Windows 2000 Server and SQL Server 2000. Lately in my event
viewer - Application Log I see just thousands of entries that state
18456 :
Login failed for user 'sa'. It happens just at random times and as far
as I know doesn't affect the server or access to it in any way.
Has anyone experinced this before? My first guess would be that it
could be some program trying to use the local 'sa' userID to login in
to SQL.
Any suggestions?
Any help would be greatly appreciated.
AlekHi Alek,
I would suggest using SQL Profiler to trace the login attempts. If your
server is accessed via the Internet I would also look at your firewall logs.
Mike O.
"Alek" <alek@.widernet.org> wrote in message
news:7703dc03.0401151430.e66191f@.posting.google.com...
quote:

> Hello,
> We have a Windows 2000 Server and SQL Server 2000. Lately in my event
> viewer - Application Log I see just thousands of entries that state
> 18456 :
> Login failed for user 'sa'. It happens just at random times and as far
> as I know doesn't affect the server or access to it in any way.
> Has anyone experinced this before? My first guess would be that it
> could be some program trying to use the local 'sa' userID to login in
> to SQL.
> Any suggestions?
> Any help would be greatly appreciated.
>
> Alek

Monday, March 26, 2012

Number of User Databases

Hello,

I am being asked to support a third part y app that will create a new database per session with upwards of 500 databases being created per month, now I know that this is not good but my bosses are asking for the technical reasons why this is not good, can someone help please? There are the obvious #of databases to maintain ie backup etc but what else can I add?

Thanks

Julian

I can think of a couple. First is memory consumption. Each open database will have in memory structures that consume virtual address space. See this article for one of the issues:http://support.microsoft.com/kb/316749/en-us

There is also some disk space implications. Each new database will need it's own system tables, allocation pages, Index roots, etc. Say this adds up to even 2mb per database that's 1000 MB/month just for metadata. If everything were in a single database you could safely assume only a few MB total over the life of the database for metadata and allocation pages.

Next is sheer capacity of the server. SQL Server currently supports 32767 databases, at over 500 databases/month that will get you by for about 65 months. Do you really want to go with a solution that will leave you high and dry after a few years.

not to mention the overhead of trying to replicate schema or index changes to thousands of databases.

HTH

-Jerome

Wednesday, March 21, 2012

Number of fields in a table

I am working on a project which requires having a form that must be filled by the user. The number of the fields on this form is arround 150. Is it a good idea to have a database table with 150 fields (columns)? If its not what would be a better approach for this case? Handling this many fields on a windows form is another issue but first I would like to know about how to deal with the data storage.

Any help is appreciated.

Thanks

its very hard to say.... you google for Database Normalisation and read about normalisation and how to normalise data.....

Madhu

|||

First of all thanks for your response,

How about if I put the form data into an XML file and keep the rest of data in database? Is it a good idea to hold information about one thing in two seperate format. (database and xml file)

I will not use the values in this form other than displaying them as a report.(Like a guy in a department will fill in the form and send it to another guy in another department for confirmation)

Thanks

|||

Hi FlatWhite,

There is no technical problem with having 150 fields in a table, but Madhu's point about normaization is valid and important. The question is whether those 150 fields should really be in the same table, meaning that all the fields are related to the key of the table, or whether they should be normalized across several tables. Understanding normalization is a core part of database design (probably the core part of database design). If you're building a database and you haven't read up on normaization yet, go do that now, before you do anything else. If you don't, you'll have problems later.

As to storing your data across two separate formats, this seems like a bad idea. Nothing wrong with XML, but when you start storing data in disparate formats without a clear technical reason for doing so, you just introduce complexity into your application. The issue with your application is the requirement of filling in 150 fields (a daunting form at best), not with how you store the data. Putting the data in XML won't make the form any easier to fill out, it will just make it more complex to access and back up your data because it will reside in two places.

You will serve you users much better by working out how to reduce the number of fields or at least provide default values for as many as possible so that it doesn't take an hour to fill in the form.

Mike

|||

Hi Mike,

Thanks for your reply. Honestly its very nice to hear that there is no technical problem with having 150 fields because I wasn't happy with this so couldn't go any further in my database design. Now I can work on.

I have been reading about normalization and I am really having difficulty of making decision about how to split data into smaller groups. Because the form I am designing is consists of say 50 independent questions. Each question (Or point to be answered) gets minimum three input. (some more) (not all questions in the same format)

Example:

Check the color of the product
Qualitative input = selection of good or bad or OK (in the customers hardcopy form this part is consists of 3 checkboxes)
Quantitative input = how big is the surface to be painted
Further Notes = Any text
From this example I made three fields for this question: ProductColorQuantitative, ProductColorQualitative and ProductColorFurtherNotes. (With roughly 50 questions it makes 150 fields)

In terms of normalization first thing that I can think of is putting every question in a seperate table :) which will not help me at all other than making things worse.
Questions are very technical questions so I don't think number of questions can be reduced.

So far I couldn't come up with a better solution. Since I don't need any of these inputs in anywhere in my program I believe it is better to leave it like it is. Do you agree?

Thanks

|||

I can think of having one table for the questions -with just a few fields:

Table: Questionnaire
Columns: Date
ResponderID
SurveyVersion
QuestionNumber
QualInput
QuantInput
Notes

Just tossing out ideas here...

|||

This question really takes me back...

For some reason questionnair design was one of the most common questions we got when I was supporting Access, so much so that we wrote a KB article to describe a table design that works well for this application and which you can read here. Don't worry that the article applies to Access, relational design is the same regardless of the database where you're designing, all the same concepts apply.

Mike

|||

Thanks for the response guys. One last thing that I am trying to figure out is if get three tables such;

Table : Responder
-
ResponderID

Table : Questions
-
QuestionID


Table : Answers
-
AnswerID
QuestionID
ResponderID
Response

I can solve the problem of having somany fields in a single table however since not all the questions get same type of input (some gets int, some gets text, some gets yes or no) I am having trouble in determining the type of the Response field in Answers table.

Am I missing a point in your posts or am I totally in wrong track?

Sorry for bothering you

FlatWhite

|||Since each question could have one of three types of response, create three columns in the table. Use the appropriate column based upon need.

Number of Databases

I have started administrating a system that has 44 databases running on the
same server. That is 44 user databases.
This is running under NT4 SP 6a and SQL 7 SP3
I am sure that SQL was not meant to support this number of databases on the
same server but unable to find any documentation to support this.
Does any one have any experience of working with this number of databases or
point me in the right direction to documentation on the number of supported
databases.
Any help would be appreciatedSQL 7.0 and 200 support up to 32.767 databases
(http://msdn.microsoft.com/library/default.asp?url=/library/en-us/architec/8
_ar_ts_8dbn.asp). But personally I prefer to limit the number per instance;
however, it really depends on application(s). If everything is working and
users are not complaining, why worry? If you have performance problems and
you have applications using different databases, then it really might be the
simplest solution to install another SQL Server on another box and transfer
half of the databases.
--
Dejan Sarka, SQL Server MVP
FAQ from Neil & others at: http://www.sqlserverfaq.com
Please reply only to the newsgroups.
PASS - the definitive, global community
for SQL Server professionals - http://www.sqlpass.org
"Mark Jones" <mark.jones@.nospam.kimdata.plus.com> wrote in message
news:FR%ab.8119$vX3.1275275@.wards.force9.net...
> I have started administrating a system that has 44 databases running on
the
> same server. That is 44 user databases.
> This is running under NT4 SP 6a and SQL 7 SP3
> I am sure that SQL was not meant to support this number of databases on
the
> same server but unable to find any documentation to support this.
> Does any one have any experience of working with this number of databases
or
> point me in the right direction to documentation on the number of
supported
> databases.
> Any help would be appreciated
>|||How many databases your application can or should support involves far too
many variables for someone to answer "44 is too many" or "44 is fine."
> point me in the right direction to documentation on the number of
supported
> databases.
This shows some of the fixed limits in the product, however there is really
no way for there to be an "official" declaration of how many databases
*your* unique application can and should support.
http://www.aspfaq.com/2345
Follow-ups set only to server.|||We regularly host over 50 databases on a server. You can have many more if
the databases are quiet. But then, you may have to settle for far fewer on a
server if the databases are heavy CPU/Disk/Memory or Nework consumers.
In general, I wouldn't consider 44 databases as too many. The number of
databases is often not the most important factor. Ultimately, it's a
resource issue (CPU, memory, disk, or Network, etc)
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Mark Jones" <mark.jones@.nospam.kimdata.plus.com> wrote in message
news:FR%ab.8119$vX3.1275275@.wards.force9.net...
> I have started administrating a system that has 44 databases running on
the
> same server. That is 44 user databases.
> This is running under NT4 SP 6a and SQL 7 SP3
> I am sure that SQL was not meant to support this number of databases on
the
> same server but unable to find any documentation to support this.
> Does any one have any experience of working with this number of databases
or
> point me in the right direction to documentation on the number of
supported
> databases.
> Any help would be appreciated
>|||I'm not sure about SQL Server 7.0 at this point, the comments below really
apply to SQL Server 2000.
There was a white paper at www.microsoft.com that discussed a scenario in
which a single instance supported several hundred databases. It was the
architecture that Microsoft used for a bCentral's hosted small business
financials offering (before they acquired Great Plains and decided to drop
the hosted offering). Unfortunately last time I looked I was unable to find
the white paper.
There are really two limits on the PRACTICAL number of databases that a
single instance can support. The first is a limit on the number of file
handles that Windows allows a process to have open at any one time. In the
hundreds of databases example it is clear that only a small subset are
actually in use at any given time and so setting the databases to autoclose
when not in use solves the handle problem. The second problem is that SQL
Enterprise Manager has some algorithms that don't scale to hundreds of
databases. Basically, it loads metadata for all of the databases whenever
you connect to the instance. With hundreds of databases this can take a
long time (I've heard someone mention an example where it took over an hour
to start Enterprise Manager). The solution here is to do all management
from the command line and not use Enterprise Manager to manage hundreds of
databases. Neither of these problems apply when you are only talking about
44-50 databases. That should work just fine without any special handling.
--
Hal Berenson, SQL Server MVP
True Mountain Group LLC
"Mark Jones" <mark.jones@.nospam.kimdata.plus.com> wrote in message
news:FR%ab.8119$vX3.1275275@.wards.force9.net...
> I have started administrating a system that has 44 databases running on
the
> same server. That is 44 user databases.
> This is running under NT4 SP 6a and SQL 7 SP3
> I am sure that SQL was not meant to support this number of databases on
the
> same server but unable to find any documentation to support this.
> Does any one have any experience of working with this number of databases
or
> point me in the right direction to documentation on the number of
supported
> databases.
> Any help would be appreciated
>|||Greg;
My guess is that you'd probably run into other PRACTICAL issues before you
run into the file handle issue. I'd generally advise against using
auto-close for any serious production database. The option has the potential
to cause too many maintenance problems, and has the performance issue.
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Hal Berenson" <haroldb@.truemountainconsulting.com> wrote in message
news:uPr1iW9fDHA.2152@.tk2msftngp13.phx.gbl...
> I'm not sure about SQL Server 7.0 at this point, the comments below really
> apply to SQL Server 2000.
> There was a white paper at www.microsoft.com that discussed a scenario in
> which a single instance supported several hundred databases. It was the
> architecture that Microsoft used for a bCentral's hosted small business
> financials offering (before they acquired Great Plains and decided to drop
> the hosted offering). Unfortunately last time I looked I was unable to
find
> the white paper.
> There are really two limits on the PRACTICAL number of databases that a
> single instance can support. The first is a limit on the number of file
> handles that Windows allows a process to have open at any one time. In
the
> hundreds of databases example it is clear that only a small subset are
> actually in use at any given time and so setting the databases to
autoclose
> when not in use solves the handle problem. The second problem is that SQL
> Enterprise Manager has some algorithms that don't scale to hundreds of
> databases. Basically, it loads metadata for all of the databases whenever
> you connect to the instance. With hundreds of databases this can take a
> long time (I've heard someone mention an example where it took over an
hour
> to start Enterprise Manager). The solution here is to do all management
> from the command line and not use Enterprise Manager to manage hundreds of
> databases. Neither of these problems apply when you are only talking
about
> 44-50 databases. That should work just fine without any special handling.
> --
> Hal Berenson, SQL Server MVP
> True Mountain Group LLC
>
> "Mark Jones" <mark.jones@.nospam.kimdata.plus.com> wrote in message
> news:FR%ab.8119$vX3.1275275@.wards.force9.net...
> > I have started administrating a system that has 44 databases running on
> the
> > same server. That is 44 user databases.
> >
> > This is running under NT4 SP 6a and SQL 7 SP3
> >
> > I am sure that SQL was not meant to support this number of databases on
> the
> > same server but unable to find any documentation to support this.
> >
> > Does any one have any experience of working with this number of
databases
> or
> > point me in the right direction to documentation on the number of
> supported
> > databases.
> >
> > Any help would be appreciated
> >
> >
>|||Sorry, I meant, Hal (not Greg).
--
Linchi Shea
linchi_shea@.NOSPAMml.com
"Linchi Shea" <linchi_shea@.NOSPAMml.com> wrote in message
news:e%2398WpAgDHA.3200@.tk2msftngp13.phx.gbl...
> Greg;
> My guess is that you'd probably run into other PRACTICAL issues before you
> run into the file handle issue. I'd generally advise against using
> auto-close for any serious production database. The option has the
potential
> to cause too many maintenance problems, and has the performance issue.
> --
> Linchi Shea
> linchi_shea@.NOSPAMml.com
>
> "Hal Berenson" <haroldb@.truemountainconsulting.com> wrote in message
> news:uPr1iW9fDHA.2152@.tk2msftngp13.phx.gbl...
> > I'm not sure about SQL Server 7.0 at this point, the comments below
really
> > apply to SQL Server 2000.
> >
> > There was a white paper at www.microsoft.com that discussed a scenario
in
> > which a single instance supported several hundred databases. It was the
> > architecture that Microsoft used for a bCentral's hosted small business
> > financials offering (before they acquired Great Plains and decided to
drop
> > the hosted offering). Unfortunately last time I looked I was unable to
> find
> > the white paper.
> >
> > There are really two limits on the PRACTICAL number of databases that a
> > single instance can support. The first is a limit on the number of file
> > handles that Windows allows a process to have open at any one time. In
> the
> > hundreds of databases example it is clear that only a small subset are
> > actually in use at any given time and so setting the databases to
> autoclose
> > when not in use solves the handle problem. The second problem is that
SQL
> > Enterprise Manager has some algorithms that don't scale to hundreds of
> > databases. Basically, it loads metadata for all of the databases
whenever
> > you connect to the instance. With hundreds of databases this can take a
> > long time (I've heard someone mention an example where it took over an
> hour
> > to start Enterprise Manager). The solution here is to do all management
> > from the command line and not use Enterprise Manager to manage hundreds
of
> > databases. Neither of these problems apply when you are only talking
> about
> > 44-50 databases. That should work just fine without any special
handling.
> >
> > --
> > Hal Berenson, SQL Server MVP
> > True Mountain Group LLC
> >
> >
> > "Mark Jones" <mark.jones@.nospam.kimdata.plus.com> wrote in message
> > news:FR%ab.8119$vX3.1275275@.wards.force9.net...
> > > I have started administrating a system that has 44 databases running
on
> > the
> > > same server. That is 44 user databases.
> > >
> > > This is running under NT4 SP 6a and SQL 7 SP3
> > >
> > > I am sure that SQL was not meant to support this number of databases
on
> > the
> > > same server but unable to find any documentation to support this.
> > >
> > > Does any one have any experience of working with this number of
> databases
> > or
> > > point me in the right direction to documentation on the number of
> > supported
> > > databases.
> > >
> > > Any help would be appreciated
> > >
> > >
> >
> >
>

number of database users

Hi,
Does anybody know whether performance is affected if all database
connections are done through the same database user name? Ie will performanc
e
be better if I had 20-30 different database users instead of one I am using
at the moment.
Personally, I am not expecting better performance!. Thanks a lot.
Panos.Rather broad question, but if you are using Connection Pooling somewhere
along the line you should see an increase in "performance" by using a single
user as opposed to multiple users since new connections may not need to be
created or maintained - SQL Server can just keep using the same one(s) over
and over- though with only 20-30 users you probably won't see much of an
increase in performance (if anything). The actual overhead on the processor
s
for 20-30 users vs one singe user probably won't be noticable, and the
queries themselves won't care.
HTH
"Panos Stavroulis." wrote:

> Hi,
> Does anybody know whether performance is affected if all database
> connections are done through the same database user name? Ie will performa
nce
> be better if I had 20-30 different database users instead of one I am usin
g
> at the moment.
> Personally, I am not expecting better performance!. Thanks a lot.
> Panos.|||You will not get worse performance using same user. You might get better per
f, if using the same
user will mean better cache hits for proc and query plans (depends on how we
ll written your SQL is).
There are other implications, of course, like traceability.
Tibor Karaszi, SQL Server MVP
http://www.karaszi.com/sqlserver/default.asp
http://www.solidqualitylearning.com/
Blog: http://solidqualitylearning.com/blogs/tibor/
"Panos Stavroulis." <PanosStavroulis@.discussions.microsoft.com> wrote in mes
sage
news:FEB14413-F110-4C8F-8E4A-294AC45BCB5C@.microsoft.com...
> Hi,
> Does anybody know whether performance is affected if all database
> connections are done through the same database user name? Ie will performa
nce
> be better if I had 20-30 different database users instead of one I am usin
g
> at the moment.
> Personally, I am not expecting better performance!. Thanks a lot.
> Panos.

number of connections

Hi,
I would like to know if I can over the limit of user connection using the
sqlserver 2005, that is 32,767 user connections(I know that I need some
hardware resource as memory, etc).
Thanks,
Serge
"Serge" <Serge@.discussions.microsoft.com> wrote in message
news:160EB448-A632-423D-BF14-7A372277BBF3@.microsoft.com...
> Hi,
> I would like to know if I can over the limit of user connection using the
> sqlserver 2005, that is 32,767 user connections(I know that I need some
> hardware resource as memory, etc).
>
I don't know of anyway.
But I'd be surprsied if you ever really needed to. That would be a MASSIVE
system that required that many simultaneous connections.
I'm curious what you're end-goal is.

> Thanks,
> Serge
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html

number of connections

Hi,
I would like to know if I can over the limit of user connection using the
sqlserver 2005, that is 32,767 user connections(I know that I need some
hardware resource as memory, etc).
Thanks,
Serge"Serge" <Serge@.discussions.microsoft.com> wrote in message
news:160EB448-A632-423D-BF14-7A372277BBF3@.microsoft.com...
> Hi,
> I would like to know if I can over the limit of user connection using the
> sqlserver 2005, that is 32,767 user connections(I know that I need some
> hardware resource as memory, etc).
>
I don't know of anyway.
But I'd be surprsied if you ever really needed to. That would be a MASSIVE
system that required that many simultaneous connections.
I'm curious what you're end-goal is.

> Thanks,
> Serge
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.htmlsql

number of connections

Hi,
I would like to know if I can over the limit of user connection using the
sqlserver 2005, that is 32,767 user connections(I know that I need some
hardware resource as memory, etc).
Thanks,
Serge"Serge" <Serge@.discussions.microsoft.com> wrote in message
news:160EB448-A632-423D-BF14-7A372277BBF3@.microsoft.com...
> Hi,
> I would like to know if I can over the limit of user connection using the
> sqlserver 2005, that is 32,767 user connections(I know that I need some
> hardware resource as memory, etc).
>
I don't know of anyway.
But I'd be surprsied if you ever really needed to. That would be a MASSIVE
system that required that many simultaneous connections.
I'm curious what you're end-goal is.
> Thanks,
> Serge
>
Greg Moore
SQL Server DBA Consulting Remote and Onsite available!
Email: sql (at) greenms.com http://www.greenms.com/sqlserver.html

Tuesday, March 20, 2012

Number of concurrent users

Hello,

There was a 5 concurrent user limitation in MSDE (the version prior to SQL Express). Does that same limitation exist with SQL Express 2005?

Thanks.

Hi Val,

First off, there was not actually a 5 concurrent user limitation in MSDE, this was a myth. Check out Euan Garden's blog describing the true functionality of the MSDE workload governer if you're interested in the history of all this: http://blogs.msdn.com/euanga/archive/2006/03/09/545576.aspx.

As for SQL Express, there is no limit to the number of users; the workload governer has been completely removed. We do limit you to a single CPU, 1 GB of memory and 4 GB of user data per database.

Regards,

Mike Wachal
SQL Express team

|||Mike,

Thanks a lot for your reply and for the link to the Blog. Very interesting.

Wednesday, March 7, 2012

NULL values

I have a text box on a web form in visual studio.net that a user enters a
number in.
If they blank out the text box then I want to put a null value back into the
database field.
I want to return the value to NULL like txtWaterDischargeRate =
System.DBNull.Value instead of Nothing but I get an error
Can't convert NULL to integer
How can I enter a null in the database field on MS SQL Server?
ThanksHi
I am not sure what you are trying to do and I'm not a webform expert, but
you should be able to set may want to try something like checking the field'
s
data length in the application and passing DBNULL.value to the stored
procedure.
Alternatively you may be able to use a special value (say -1) and use
NULLIF(@.parameter,-1) in your insert statement.
John
"Craig" wrote:

> I have a text box on a web form in visual studio.net that a user enters a
> number in.
> If they blank out the text box then I want to put a null value back into t
he
> database field.
> I want to return the value to NULL like txtWaterDischargeRate =
> System.DBNull.Value instead of Nothing but I get an error
> Can't convert NULL to integer
> How can I enter a null in the database field on MS SQL Server?
> Thanks
>
>
>|||Sample code.....
With DataSetLocationsForm1.tblLocations(0)
.WaterDischargeCost = txtWaterDischargeCost.Text
.MoreFields = txtOtherTextboxes.Text
End With
SqlDataAdapter1.Update(DataSetLocationsForm1)
The WaterDischargeCost field in the database is an type real. If they blank
out the text box and click the SAVE button on an existing record I get an
error "Can't convert NULL to integer"
I want to put a null value back into the database field
How do I do this?
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...[vbcol=seagreen]
> Hi
> I am not sure what you are trying to do and I'm not a webform expert, but
> you should be able to set may want to try something like checking the
> field's
> data length in the application and passing DBNULL.value to the stored
> procedure.
> Alternatively you may be able to use a special value (say -1) and use
> NULLIF(@.parameter,-1) in your insert statement.
> John
> "Craig" wrote:
>|||Hi Craig,
Thanks for your post.
From your descriptions, I understood you would like to know how to how to
handle NULL with SQL Server in VS.NET. If I have misunderstood your
concern, please feel free to point it out.
To better answer this question, I would recommand you raise the question in
ADO.NET or VS.NET managed newsgroup.
microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.framework
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
========================================
=============
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi
This is almost certainly because you are passing as string "NULL" and not
NULL itself.
Try something like (although the syntax may not be correct!)
IF txtWaterDischargeCost.length > 0
.WaterDischargeCost = txtWaterDischargeCost.Text
ELSE
.WaterDischargeCost = System.DBNull
You can use SQL profiler to see the SQL statement sent to the database and
verify what the command actually is.
John
"Craig" wrote:

> Sample code.....
> With DataSetLocationsForm1.tblLocations(0)
> .WaterDischargeCost = txtWaterDischargeCost.Text
> .MoreFields = txtOtherTextboxes.Text
> End With
> SqlDataAdapter1.Update(DataSetLocationsForm1)
> The WaterDischargeCost field in the database is an type real. If they blan
k
> out the text box and click the SAVE button on an existing record I get an
> error "Can't convert NULL to integer"
> I want to put a null value back into the database field
> How do I do this?
> Thanks
>
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...
>
>|||If the column WaterDischargeCost is nullable (minoccurs = 0), then you can
use:
DataSetLocationsForm1.tblLocations(0).SetWaterDischargeCostNull()
to let the dataset set the value as null.
This works!!!!
"Craig" <NoSpam@.hotmail.com> wrote in message
news:O6UVrbCqFHA.3160@.TK2MSFTNGP14.phx.gbl...
> Sample code.....
> With DataSetLocationsForm1.tblLocations(0)
> .WaterDischargeCost = txtWaterDischargeCost.Text
> .MoreFields = txtOtherTextboxes.Text
> End With
> SqlDataAdapter1.Update(DataSetLocationsForm1)
> The WaterDischargeCost field in the database is an type real. If they
> blank out the text box and click the SAVE button on an existing record I
> get an error "Can't convert NULL to integer"
> I want to put a null value back into the database field
> How do I do this?
> Thanks
>
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...
>

NULL values

I have a text box on a web form in visual studio.net that a user enters a
number in.
If they blank out the text box then I want to put a null value back into the
database field.
I want to return the value to NULL like txtWaterDischargeRate = System.DBNull.Value instead of Nothing but I get an error
Can't convert NULL to integer
How can I enter a null in the database field on MS SQL Server?
ThanksHi
I am not sure what you are trying to do and I'm not a webform expert, but
you should be able to set may want to try something like checking the field's
data length in the application and passing DBNULL.value to the stored
procedure.
Alternatively you may be able to use a special value (say -1) and use
NULLIF(@.parameter,-1) in your insert statement.
John
"Craig" wrote:
> I have a text box on a web form in visual studio.net that a user enters a
> number in.
> If they blank out the text box then I want to put a null value back into the
> database field.
> I want to return the value to NULL like txtWaterDischargeRate => System.DBNull.Value instead of Nothing but I get an error
> Can't convert NULL to integer
> How can I enter a null in the database field on MS SQL Server?
> Thanks
>
>
>|||Sample code.....
With DataSetLocationsForm1.tblLocations(0)
.WaterDischargeCost = txtWaterDischargeCost.Text
.MoreFields = txtOtherTextboxes.Text
End With
SqlDataAdapter1.Update(DataSetLocationsForm1)
The WaterDischargeCost field in the database is an type real. If they blank
out the text box and click the SAVE button on an existing record I get an
error "Can't convert NULL to integer"
I want to put a null value back into the database field
How do I do this?
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...
> Hi
> I am not sure what you are trying to do and I'm not a webform expert, but
> you should be able to set may want to try something like checking the
> field's
> data length in the application and passing DBNULL.value to the stored
> procedure.
> Alternatively you may be able to use a special value (say -1) and use
> NULLIF(@.parameter,-1) in your insert statement.
> John
> "Craig" wrote:
>> I have a text box on a web form in visual studio.net that a user enters a
>> number in.
>> If they blank out the text box then I want to put a null value back into
>> the
>> database field.
>> I want to return the value to NULL like txtWaterDischargeRate =>> System.DBNull.Value instead of Nothing but I get an error
>> Can't convert NULL to integer
>> How can I enter a null in the database field on MS SQL Server?
>> Thanks
>>
>>|||Hi Craig,
Thanks for your post.
From your descriptions, I understood you would like to know how to how to
handle NULL with SQL Server in VS.NET. If I have misunderstood your
concern, please feel free to point it out.
To better answer this question, I would recommand you raise the question in
ADO.NET or VS.NET managed newsgroup.
microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.framework
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
=====================================================
This posting is provided "AS IS" with no warranties, and confers no rights.|||Hi
This is almost certainly because you are passing as string "NULL" and not
NULL itself.
Try something like (although the syntax may not be correct!)
IF txtWaterDischargeCost.length > 0
.WaterDischargeCost = txtWaterDischargeCost.Text
ELSE
.WaterDischargeCost = System.DBNull
You can use SQL profiler to see the SQL statement sent to the database and
verify what the command actually is.
John
"Craig" wrote:
> Sample code.....
> With DataSetLocationsForm1.tblLocations(0)
> .WaterDischargeCost = txtWaterDischargeCost.Text
> .MoreFields = txtOtherTextboxes.Text
> End With
> SqlDataAdapter1.Update(DataSetLocationsForm1)
> The WaterDischargeCost field in the database is an type real. If they blank
> out the text box and click the SAVE button on an existing record I get an
> error "Can't convert NULL to integer"
> I want to put a null value back into the database field
> How do I do this?
> Thanks
>
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...
> > Hi
> >
> > I am not sure what you are trying to do and I'm not a webform expert, but
> > you should be able to set may want to try something like checking the
> > field's
> > data length in the application and passing DBNULL.value to the stored
> > procedure.
> >
> > Alternatively you may be able to use a special value (say -1) and use
> > NULLIF(@.parameter,-1) in your insert statement.
> >
> > John
> >
> > "Craig" wrote:
> >
> >> I have a text box on a web form in visual studio.net that a user enters a
> >> number in.
> >>
> >> If they blank out the text box then I want to put a null value back into
> >> the
> >> database field.
> >>
> >> I want to return the value to NULL like txtWaterDischargeRate => >> System.DBNull.Value instead of Nothing but I get an error
> >>
> >> Can't convert NULL to integer
> >>
> >> How can I enter a null in the database field on MS SQL Server?
> >>
> >> Thanks
> >>
> >>
> >>
> >>
> >>
>
>|||If the column WaterDischargeCost is nullable (minoccurs = 0), then you can
use:
DataSetLocationsForm1.tblLocations(0).SetWaterDischargeCostNull()
to let the dataset set the value as null.
This works!!!!
"Craig" <NoSpam@.hotmail.com> wrote in message
news:O6UVrbCqFHA.3160@.TK2MSFTNGP14.phx.gbl...
> Sample code.....
> With DataSetLocationsForm1.tblLocations(0)
> .WaterDischargeCost = txtWaterDischargeCost.Text
> .MoreFields = txtOtherTextboxes.Text
> End With
> SqlDataAdapter1.Update(DataSetLocationsForm1)
> The WaterDischargeCost field in the database is an type real. If they
> blank out the text box and click the SAVE button on an existing record I
> get an error "Can't convert NULL to integer"
> I want to put a null value back into the database field
> How do I do this?
> Thanks
>
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...
>> Hi
>> I am not sure what you are trying to do and I'm not a webform expert, but
>> you should be able to set may want to try something like checking the
>> field's
>> data length in the application and passing DBNULL.value to the stored
>> procedure.
>> Alternatively you may be able to use a special value (say -1) and use
>> NULLIF(@.parameter,-1) in your insert statement.
>> John
>> "Craig" wrote:
>> I have a text box on a web form in visual studio.net that a user enters
>> a
>> number in.
>> If they blank out the text box then I want to put a null value back into
>> the
>> database field.
>> I want to return the value to NULL like txtWaterDischargeRate =>> System.DBNull.Value instead of Nothing but I get an error
>> Can't convert NULL to integer
>> How can I enter a null in the database field on MS SQL Server?
>> Thanks
>>
>>
>

Saturday, February 25, 2012

NULL values

I have a text box on a web form in visual studio.net that a user enters a
number in.
If they blank out the text box then I want to put a null value back into the
database field.
I want to return the value to NULL like txtWaterDischargeRate =
System.DBNull.Value instead of Nothing but I get an error
Can't convert NULL to integer
How can I enter a null in the database field on MS SQL Server?
Thanks
Hi
I am not sure what you are trying to do and I'm not a webform expert, but
you should be able to set may want to try something like checking the field's
data length in the application and passing DBNULL.value to the stored
procedure.
Alternatively you may be able to use a special value (say -1) and use
NULLIF(@.parameter,-1) in your insert statement.
John
"Craig" wrote:

> I have a text box on a web form in visual studio.net that a user enters a
> number in.
> If they blank out the text box then I want to put a null value back into the
> database field.
> I want to return the value to NULL like txtWaterDischargeRate =
> System.DBNull.Value instead of Nothing but I get an error
> Can't convert NULL to integer
> How can I enter a null in the database field on MS SQL Server?
> Thanks
>
>
>
|||Sample code.....
With DataSetLocationsForm1.tblLocations(0)
.WaterDischargeCost = txtWaterDischargeCost.Text
.MoreFields = txtOtherTextboxes.Text
End With
SqlDataAdapter1.Update(DataSetLocationsForm1)
The WaterDischargeCost field in the database is an type real. If they blank
out the text box and click the SAVE button on an existing record I get an
error "Can't convert NULL to integer"
I want to put a null value back into the database field
How do I do this?
Thanks
"John Bell" <jbellnewsposts@.hotmail.com> wrote in message
news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...[vbcol=seagreen]
> Hi
> I am not sure what you are trying to do and I'm not a webform expert, but
> you should be able to set may want to try something like checking the
> field's
> data length in the application and passing DBNULL.value to the stored
> procedure.
> Alternatively you may be able to use a special value (say -1) and use
> NULLIF(@.parameter,-1) in your insert statement.
> John
> "Craig" wrote:
|||Hi Craig,
Thanks for your post.
From your descriptions, I understood you would like to know how to how to
handle NULL with SQL Server in VS.NET. If I have misunderstood your
concern, please feel free to point it out.
To better answer this question, I would recommand you raise the question in
ADO.NET or VS.NET managed newsgroup.
microsoft.public.dotnet.framework.adonet
microsoft.public.dotnet.framework
Thank you for your patience and cooperation. If you have any questions or
concerns, don't hesitate to let me know. We are always here to be of
assistance!
Sincerely yours,
Michael Cheng
Microsoft Online Partner Support
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
================================================== ===
This posting is provided "AS IS" with no warranties, and confers no rights.
|||Hi
This is almost certainly because you are passing as string "NULL" and not
NULL itself.
Try something like (although the syntax may not be correct!)
IF txtWaterDischargeCost.length > 0
..WaterDischargeCost = txtWaterDischargeCost.Text
ELSE
..WaterDischargeCost = System.DBNull
You can use SQL profiler to see the SQL statement sent to the database and
verify what the command actually is.
John
"Craig" wrote:

> Sample code.....
> With DataSetLocationsForm1.tblLocations(0)
> .WaterDischargeCost = txtWaterDischargeCost.Text
> .MoreFields = txtOtherTextboxes.Text
> End With
> SqlDataAdapter1.Update(DataSetLocationsForm1)
> The WaterDischargeCost field in the database is an type real. If they blank
> out the text box and click the SAVE button on an existing record I get an
> error "Can't convert NULL to integer"
> I want to put a null value back into the database field
> How do I do this?
> Thanks
>
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...
>
>
|||If the column WaterDischargeCost is nullable (minoccurs = 0), then you can
use:
DataSetLocationsForm1.tblLocations(0).SetWaterDisc hargeCostNull()
to let the dataset set the value as null.
This works!!!!
"Craig" <NoSpam@.hotmail.com> wrote in message
news:O6UVrbCqFHA.3160@.TK2MSFTNGP14.phx.gbl...
> Sample code.....
> With DataSetLocationsForm1.tblLocations(0)
> .WaterDischargeCost = txtWaterDischargeCost.Text
> .MoreFields = txtOtherTextboxes.Text
> End With
> SqlDataAdapter1.Update(DataSetLocationsForm1)
> The WaterDischargeCost field in the database is an type real. If they
> blank out the text box and click the SAVE button on an existing record I
> get an error "Can't convert NULL to integer"
> I want to put a null value back into the database field
> How do I do this?
> Thanks
>
>
> "John Bell" <jbellnewsposts@.hotmail.com> wrote in message
> news:9FE6B6DA-00CE-448A-A740-2E950BC1AC57@.microsoft.com...
>

Null User Problem

Here is what we have going on...

we have 2 servers, the web server (A), and a SQL cluster (B). When a user visits a website on A there is some stored procedures that get called on B. We would like those stored procedures to be executed using the "network users" login. We try to implement this by doing the following:


the connection string looks like this
<add key="ConnectionString" value="Workstation ID=UTMPLMDBT;Packet Size=4096;Integrated Security=SSPI;Data Source=XXX.XXX.XXX.XXX,xxxx;Persist Security Info=False;Initial Catalog=XXXX" /
we added this in the web.config
<authentication mode="Windows" />
<identity impersonate="true"/>

-The web server is running IIS 6 on windows 2003 server
-We currently do not used Active Directory
-SQL cluster is running SQL 2000 on windows 2003 server

The error we are currently getting is:
Login failed for user '(null)'. Reason: Not associated with a trusted SQL Server connection.

This error occurs when we try sqlConn.Open()

Any help would be greatly appreciated,
TreyHere is some other information...I wrote the following program...


Dim authUserName As String
Dim aspUserName As String
authUserName = User.Identity.Name
aspUserName = Principal.WindowsIdentity.GetCurrent.Name
authUserPrincipalLabel.Text = "You are: " & authUserName
aspPrincipalLabel.Text = "This page runs as: " & aspUserName

it displays:

You are:MYDomain\144205
This page runs as: MYDomain\144205

So I'm not sure what is going wrong|||This:

::We would like those stored procedures to be executed using the "network users" login

and this:

::<authentication mode="Windows" />
::<identity impersonate="true"/
contradicts. The statement will get executed using the identity of the user making the call, IF the page is protected, null (imho - am I correct here?) if anonymous access is allowed (or: the asp.net worker process identity, which is NOT network_users and a local account, unless reconfigured, which you did not say you did).|||When I said,
::We would like those stored procedures to be executed using the "network users" login
I mean I want to log into SQL using the users network username (ex) Mydomain\Trey
and password and execute the the procedure.

anonymous access is not allowed (not checked) in or IIS server.

I'm gettng kinda lost...how do I do this?

Thanks,
Trey|||OK after much reading...I was wondering if I can try the following

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/secmod/html/secmod15.asp

without using active directory?

Thanks,
Trey|||::OK after much reading...

NOW you deserve a good answer :-) And this is not meant sarcastic. You proapbly learned a lot about how the WIndows Security System works, and this is sort of exactly what you need.

Could you describe the server side network setup?

Basically, what you can do is:

* One Server: create a custom asp.net account, give it rights in the database, do NOT use impersonation. Voila.
* Multiple Servers: no impersonation, no trusted connection, turn the server to "mixed mode", use username and password.

Unter 99% of the cases the real user should NOT map through to the database.|||Ok...what we did is created a minimum privileged domain account, "Me"

Added this to the web.config


<identity impersonate="true" userName="MyDomain\Me"password="Something" />

Just a note I am not going to leave the Username and Password in clear text.

And we connected successfully. Whoop!

So I tried something else... I changed the web.config file back to:


<identity impersonate="true" />

and logged in as the new "Me" account
I got the account null error again. I guess I'm getting lost on what is going on in the back end.

The reason I would like to use the real user is for auditing purposes. So we know who is doing every select, insert, ect. Would it be better just to pass the users info as a value in the stored procedure?

Thanks,
Trey

null user login failed

I'm new to Crystal Reports and ASP and I'm sure i'm missing something simple here.

I've got a SQL server database, A Crystal Report, a VB application and an ASP Application

In the VB app i call the crystal report and log on to the database with the intergrated security

However in the ASP app i try the same and it has me log on as a null user.

what have i forgotten to do that will let the intergrated security work between SQL Server and ASPyou need to use impersonation in IIS so that IIS uses the credentials of the user, rather than of the nt account the IIS service is running as.|||Thank you i knew it was something simple i was missing

Monday, February 20, 2012

Null parameter in uniqueidentifier field

I have the following database structure:

The table aspnet_users, which we all know

Another table with an uniqueidentifier which references the user iD

I want to set the value of the iD in one of the entries in the second table to null.

I tried this:
string assigned is null, i am passing this as a method parameter
............
string queryString = "UPDATE [table2] SET AssignedUserId=@.assigned WHERE ProblemId = @.id";
System.Data.IDbCommand dbCommand = new System.Data.SqlClient.SqlCommand();
...............
System.Data.IDataParameter dbParam_au_pr = new System.Data.SqlClient.SqlParameter();
dbParam_au_pr.ParameterName = "@.assigned";
if (assigned == null)
{
dbParam_au_pr.Value = null;
}
else
{
dbParam_au_pr.Value = assigned;
}
dbParam_au_pr.DbType = System.Data.DbType.String ;
dbCommand.Parameters.Add(dbParam_au_pr);

I also tried using "" instead of null, or not using that "if" statement at all.
I get an error that says:

Parameterized Query '(@.id nvarchar(1),@.assignednvarchar(4000))UPDATE [tracker_Probl' expects parameter @.assigned,which was not supplied.

Please help with this as soon as possible.ThanksTry using DBNull.Value instead of null:
dbParam_au_pr.Value = DBNull.Value;

Null multi-value parameters

How do you configure a multi-value parameter so it will allow the user to not enter the parameter?

I'm using integer multi-value parameters. I can't set the parameter to allow null, and when I preview the report and leave the parameter blank, it tells me to enter at least one value. I tried it with string parameters, and the report just doesn't run in preview if you don't enter any values, even if you choose "allow blank".

How do you specify a multi-value parameter to allow "empty" or "null"?Hope this will help you,
use TSQL for mutiple value parameter
select NULL as ID
union
select ID from table1|||I'm talking about Report Parameters in SSRS. Your SQL doesn't even use any parameters. How can this help?
|||Yes, I guess that he was also talkling about :-) Define a dataset which is filled with the parameters you want to display and in addition the NULL parameter (with the UNION mentioned above) You can also use something like "Select a value" as your display value for the NULL parameter. Then set the default value to non-queried and set the value to NULL. The Report will then open with the Report parameter list and set the "Select a value" value. In qour query you will have to handle the NULL appearance like the following mentioned example

WHERE
@.YourParameter IS NULL OR
YourColumn IN (@.YourParameter)

Jens K. Suessmeyer.

http://www.sqlserver2005.de
|||Ah, I see. This is for "Available values" in the parameter configuration. However, this wouldn't work for me, because when I deploy my reports the parameters are configured by a separate program, which then passes them to the webservice.

I did try what you suggested, and it didn't work as you describe. In preview, the values from the table were available to choose from, but the null value I created with UNION was not there.

I'm not sure how this would work anyway, because the parameter configuration is actually set to not "Allow null". So even if you could pick a null you might still get an error.

What I need is to be able to check "Allow null" for a multi-value parameter, but it gives an error when I try that. Does anyone even know why this is not allowed for multi-value parameters? It seems like a last-minute hack to protect some coding flaw.
|||then file it as a bug on connect.microsoft.com . The RS team keeps track of the posted bugs there.

Jens K. Suessmeyer.

http://www.sqlserver2005.de

NULL login name as dbo in database

Hi all!
Recently, every database i create - regardless the user -
comes with the dbo user with NULL login name.
My older databases were created correctly, with "sa" as "dbo".
I am running SQL Server 2000 SP3 on PIII 800Mhz 512MB
Tanks in advance!
DiegoYou can change database ownership to the correct owner using
sp_changedbowner:
USE MyDatabase
EXEC sp_changedbowner 'sa'
I'm not sure why new databases would get created with a NULL dbo. What
does sp_helpdb and sp_helpuser report?
--
Hope this helps.
Dan Guzman
SQL Server MVP
--
SQL FAQ links (courtesy Neil Pike):
http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
http://www.sqlserverfaq.com
http://www.mssqlserver.com/faq
--
"Diego Dias" <diego.dias@.terra.com.br> wrote in message
news:053601c38d11$14ed91e0$a301280a@.phx.gbl...
> Hi all!
> Recently, every database i create - regardless the user -
> comes with the dbo user with NULL login name.
> My older databases were created correctly, with "sa" as "dbo".
> I am running SQL Server 2000 SP3 on PIII 800Mhz 512MB
> Tanks in advance!
> Diego|||This occurs when you use EM and are connected with NT-authentication.
EM then shows you NT-account and when you select the ussers-tab, dbo has no
accout associatted.
(personaly, I always reroute dbo to sa, even if my developers don't like it
because they have to create tables dbo.** and have to code the 'dbo.'-part )
Jobi
"Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
news:uRT5rfUjDHA.1284@.TK2MSFTNGP09.phx.gbl...
> You can change database ownership to the correct owner using
> sp_changedbowner:
> USE MyDatabase
> EXEC sp_changedbowner 'sa'
> I'm not sure why new databases would get created with a NULL dbo. What
> does sp_helpdb and sp_helpuser report?
> --
> Hope this helps.
> Dan Guzman
> SQL Server MVP
> --
> SQL FAQ links (courtesy Neil Pike):
> http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> http://www.sqlserverfaq.com
> http://www.mssqlserver.com/faq
> --
> "Diego Dias" <diego.dias@.terra.com.br> wrote in message
> news:053601c38d11$14ed91e0$a301280a@.phx.gbl...
> > Hi all!
> >
> > Recently, every database i create - regardless the user -
> > comes with the dbo user with NULL login name.
> >
> > My older databases were created correctly, with "sa" as "dbo".
> >
> > I am running SQL Server 2000 SP3 on PIII 800Mhz 512MB
> >
> > Tanks in advance!
> >
> > Diego
>|||> This occurs when you use EM and are connected with NT-authentication.
> EM then shows you NT-account and when you select the ussers-tab, dbo
has no
> accout associatted.
This can be corrected with sp_changedbowner. This may occur when a
database is restored or attached but I haven't seen the problem with
CREATE DATABASE.
--
Hope this helps.
Dan Guzman
SQL Server MVP
"jobi" <jobi@.reply2.group> wrote in message
news:bm0b8s$6q4$1@.reader08.wxs.nl...
> This occurs when you use EM and are connected with NT-authentication.
> EM then shows you NT-account and when you select the ussers-tab, dbo
has no
> accout associatted.
> (personaly, I always reroute dbo to sa, even if my developers don't
like it
> because they have to create tables dbo.** and have to code the
'dbo.'-part )
> Jobi
>
> "Dan Guzman" <danguzman@.nospam-earthlink.net> wrote in message
> news:uRT5rfUjDHA.1284@.TK2MSFTNGP09.phx.gbl...
> > You can change database ownership to the correct owner using
> > sp_changedbowner:
> >
> > USE MyDatabase
> > EXEC sp_changedbowner 'sa'
> >
> > I'm not sure why new databases would get created with a NULL dbo.
What
> > does sp_helpdb and sp_helpuser report?
> >
> > --
> > Hope this helps.
> >
> > Dan Guzman
> > SQL Server MVP
> >
> > --
> > SQL FAQ links (courtesy Neil Pike):
> >
> > http://www.ntfaq.com/Articles/Index.cfm?DepartmentID=800
> > http://www.sqlserverfaq.com
> > http://www.mssqlserver.com/faq
> > --
> >
> > "Diego Dias" <diego.dias@.terra.com.br> wrote in message
> > news:053601c38d11$14ed91e0$a301280a@.phx.gbl...
> > > Hi all!
> > >
> > > Recently, every database i create - regardless the user -
> > > comes with the dbo user with NULL login name.
> > >
> > > My older databases were created correctly, with "sa" as "dbo".
> > >
> > > I am running SQL Server 2000 SP3 on PIII 800Mhz 512MB
> > >
> > > Tanks in advance!
> > >
> > > Diego
> >
> >
>|||<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1">
<title></title>
</head>
<body text="#000000" bgcolor="#ffffff">
Dan and everybody that ansewered,<br>
<br>
You're all right, i was connected in EM as NT Admin account. <br>
<br>
I ran the sp_changedbowner and solved my problem.<br>
<br>
Thanks!<br>
<br>
Diego Dias<br>
Brazil<br>
<br>
Dan Guzman wrote:<br>
<blockquote type="cite"
cite="mid%23BrzYOZjDHA.4008@.TK2MSFTNGP11.phx.gbl">
<blockquote type="cite">
<pre wrap="">This occurs when you use EM and are connected with NT-authentication.
EM then shows you NT-account and when you select the ussers-tab, dbo
</pre>
</blockquote>
<pre wrap=""><!-->has no
</pre>
<blockquote type="cite">
<pre wrap="">accout associatted.
</pre>
</blockquote>
<pre wrap=""><!-->
This can be corrected with sp_changedbowner. This may occur when a
database is restored or attached but I haven't seen the problem with
CREATE DATABASE.
</pre>
</blockquote>
<br>
</body>
</html>

NULL in Temp Tables

Forum,

I am looking at another report code (constructed by another user) and wanted to know why the user coded the word NULL after each field in the Temp tables. What does the NULL tell me and why would the user use it? Sorry for the Newb question ... I'm still learning the language and could not find any information in the help files.

Report Code

/* Billing Status */
SET NOCOUNT ON
CREATE TABLE #Appt( FacilityId int NULL,
Visit datetime NULL,
OwnerId int NULL,
DoctorId int NULL,
CompanyId int NULL,
ApptSetId int NULL,
CasesId int NULL
)

CREATE TABLE #Temp( Visit datetime NULL,
PatientId varchar(15) NULL,
PatientName varchar(90) NULL,
DoctorName varchar(60) NULL,
ApprovalResults text NULL,
Description varchar(255) NULL,
Status varchar(255) NULL,
LastFiledDate datetime NULL,
PatientBal money,
InsuranceBal money,
InsuranceName varchar(50) NULL
)

Jeff:

I see that most of the columns have the explicity NULL specification and that these two columns do not:

PatientBal money,
InsuranceBal money,

It is possible that you are in a situation in which column defaults have been designated as NOT NULL and that in this case explicit NULL specifications are necessary to allow nulls for these columns. In any case, the author is explicitly describing each of these columns as nullable. Try looking up ANSI_NULL_DFLT_ON and ANSI_NULL_DFLT_OFF in books online.

|||Another thing to check is SP_DBOPTION and look at the setting for 'ANSI null default'|||

Null just means that the value is not known, (or that it is left blank intentionally is another common, though less right, usage). The programmer just wanted to make sure that if a value was NULL when data is being put into the temp tables it would not cause an error.

This is not really good practice, unless it is actually reasonable that values can be NULL, since NULLs really increases the complexity of working with data, but if the data allows nulls, then it is acceptable.