Showing posts with label wrong. Show all posts
Showing posts with label wrong. Show all posts

Friday, March 9, 2012

Dos and Donts of SQL

Well guys this may be the wrong place but an earlier post by an
"expert" about how a table was poorly designed has piqued my interest.
The question is this. What are the do's and don'ts of sql development?

Please list what you consider to be good and bad practices in general
and/or specific or list links to resources that would be considered
under this topic.

When I consider best practices myself of course there is always the
standards of 3nf and such but what about when it comes to standard
table structures and field sizes for say a Name (first, last, etc) and
contacts table. What about naming conventions and common entities and
structures.

It seems to me that every SQL Developer that enters this field starts
out with the basics of how the technology works and a little of the
practices. Yet from there I see many different directions that they
go.

To start this conversation out let me propose some things that I have
questions about. Feel free to expand and add to this list.

1. What would you consider the standard/best way to represent a
gender.

2. Field Size for Names and address First/Last Etc.

3. Include or don't include City/State in an address/contact list.

4. Structure of a Generic Contact list.

5. Practices for dealing with pictures and documents as well as
related table structures.

6. Level of normalization to aim for. (My minimum is 3 but I
generally hit Boyce Codd myself)

7. What datatypes to avoid and why.

Two requests.
1. Keep it polite.
2. Be constructive and complete.Just as I was posting this I saw a link to a fine articles on the best
practices. Here it is

http://vyaskn.tripod.com/coding_conventions.htm|||Want to wait a bit for my next book, SQL PROGRAMMING STYLE to come out?

1. What would you consider the standard/best way to represent a
gender. Use the ISO codes, since they are standards, of course.

2. Field [sic] Size for Names and address First/Last Etc. Use the USPS
model, which is based on a five line, 3.5 inch label with 10 pitch type
on it.

3. Include or don't include City/State in an address/contact list.
Include it since you need it to mail anything.

4. Structure of a Generic Contact list. Unh? That is not a question.

5. Practices for dealing with pictures and documents as well as
related table structures. Use tools intended for them. There are
several good textbases. I have not worked with graphic search tools.

6. Level of normalization to aim for. (My minimum is 3 but I
generally hit Boyce Codd myself) if you use an ORM model instead of
ER, you will get to 5NF.

7. What datatypes to avoid and why. Anything proprietary because it
will not port, cannot be guaranteed to be consistent from one release
to the next, etc.|||Well CELKO said me a copy to review and I'll be happy to read it :)
However many people's first target for questions and advise is the
internet and usegroups like this.
This is a resource that we need to continue to support and add to.
Since it is a resouce for all of us. Not just those with a specific
book on their shelf. (not to down play your book which I actually may
go get or look at after it's published) Good luck with the book in the
meantime.|||I had a comment on the normalization. We have a reporting database that is
updated nightly. It runs on a little server for only management accesses.
If I normalized this database, reports would run 10 minutes. I normally
build non-normalized tables for the reports and they run in a couple of
seconds. Therefore, my point is normalization really depends on the desired
application.

"Dan Gidman" <danatcofo@.gmail.com> wrote in message
news:1113403304.346956.186420@.g14g2000cwa.googlegr oups.com...
> Well guys this may be the wrong place but an earlier post by an
> "expert" about how a table was poorly designed has piqued my interest.
> The question is this. What are the do's and don'ts of sql development?
> Please list what you consider to be good and bad practices in general
> and/or specific or list links to resources that would be considered
> under this topic.
> When I consider best practices myself of course there is always the
> standards of 3nf and such but what about when it comes to standard
> table structures and field sizes for say a Name (first, last, etc) and
> contacts table. What about naming conventions and common entities and
> structures.
> It seems to me that every SQL Developer that enters this field starts
> out with the basics of how the technology works and a little of the
> practices. Yet from there I see many different directions that they
> go.
> To start this conversation out let me propose some things that I have
> questions about. Feel free to expand and add to this list.
> 1. What would you consider the standard/best way to represent a
> gender.
> 2. Field Size for Names and address First/Last Etc.
> 3. Include or don't include City/State in an address/contact list.
> 4. Structure of a Generic Contact list.
> 5. Practices for dealing with pictures and documents as well as
> related table structures.
> 6. Level of normalization to aim for. (My minimum is 3 but I
> generally hit Boyce Codd myself)
> 7. What datatypes to avoid and why.
> Two requests.
> 1. Keep it polite.
> 2. Be constructive and complete.|||>> I normally build non-normalized tables for the reports .. <<

This is a "Data Warehouse" versus "OLTP database"; you can do this only
because the warehouse is loaded from a normalized production database
and then is never updated while in use. A data warehouse is a very
different game. Even teh quereis are different.

Friday, February 17, 2012

DOH! Uninstall of 2005 gone horribly wrong

I am an old hand at RDBMS but have been using SQL Server for only 1 year. I have a local install of 2005 Developer Edition, and also access a number of 2000 and 2005 instances on remote and network servers. OK, so on 3/16 (after installing the 3/15 Windows Security Updates), I began getting this error when invoking any 2005 DB under Object Explorer in Management Studio "SQLWB - SQL Server Management Studio has encountered a problem and needs to close. We are sorry for the inconvenience." Very helpful. So I ran a debug and got some unhandled exception errors:

'SqlWb.exe': Loaded 'C:\WINDOWS\system32\wbem\wbemsvc.dll', No symbols loaded.
'SqlWb.exe': Loaded 'C:\WINDOWS\system32\wbem\fastprox.dll', No symbols loaded.
'SqlWb.exe': Loaded 'C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\diasymreader.dll', No symbols loaded.
'SqlWb.exe': Loaded 'C:\WINDOWS\system32\apphelp.dll', No symbols loaded.
The thread 'Win32 Thread' (0x21c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xa98) has exited with code 0 (0x0).
Unhandled exception at 0x79ea69f3 in SqlWb.exe: 0xC0000006: In page error.
First-chance exception at 0x79ea69f3 in SqlWb.exe: 0xC0000005: Access violation reading location 0x088b200c.
Unhandled exception at 0x79ea69f3 in SqlWb.exe: 0xC0000005: Access violation reading location 0x088b200c.
First-chance exception at 0x79ea69f3 in SqlWb.exe: 0xC0000005: Access violation reading location 0x088b200c.

After some poking around, my DBA told me that we had upgraded the servers for our team to SP1, and I should install that, because the file being read did not 'match up' with the commands. But when I did so I got the warning:

- Edition Change Check (Warning)

Messages

Edition Change Check

To change an existing instance of Microsoft SQL Server 2005 to a different edition of SQL Server 2005, you must run SQL Server 2005 Setup from the command prompt and include the SKUUPGRADE=1 parameter.

I researched this information, but it didn't really apply to my situation. So I selected 'CONTINUE' and everything went downhill from there. The install downloaded the SP1 setup support files (which by the way "cannot be removed") and then aborted. I poked around some more and decided it would be easiest to Uninstall and Reinstall the Dev Edition from the DVD and then apply the SP. The uninstall went fine until it got to the tools (which apparently were my real problem to start with). When I attempt to uninstall the tools, I get the following message:

"Error reading from file C:\Windows\assembly\GAC_MSIL\Microsoft.SqlServer.SqlEnum\9.0.242.0__89845dcd8080cc91\Microsoft.SqlServer.SqlEnum.dll

Verify that this file exists and that you can access it"

This message is presented with Retry and Cancel options. The file does NOT exist, so Retry is not useful and cancel rolls back the entire uninstall.

Error signature:

EventType : sql90setup P1 : installfinalize P2 : 0x643 P3 : unknown
P4 : 0x519 P5 : unknown P6 : unknown
P7 : sqlrun_tools.msi@.9.00.1399.06

In this part SP1/half uninstalled 2005 environment I am stuck like chuck. I have searched for this dll online and on other folders of my hard drive to no avail. I have also dug through these forums until my eyes are crossed.

Can anyone help?!?

One more search location turned up the answer here: http://support.microsoft.com/default.aspx/kb/909953

Turns out the tools are considered components. You can remove services and instances from the REMOVE dialog, but you have to CHANGE the client components (under workstation components) and de-select Management Tools.

I cannot believe how long it took me to find this; I finally found it today in the setup help information on the install DVD while preparing for the install. I'll leave this here for others who check the boards before the knowledge base.

THANKS to anyone who put thought into this today.

|||

Thanks for following up your own post. It prevents others from wasting their time trying to help you after you have solved the problem, and it helps others when you share your solution.