Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
natus
Starting Member
2 Posts |
Posted - 2012-07-04 : 03:59:33
|
| Is anyone familiar with documenting SQL queries? I'm going to create an entity relation diagram of each query. Should I make one "extra" table for SELECT clause's attributes or should I place those attributes in to the tables where they originally are placed. |
|
|
nigelrivett
Master Smack Fu Yak Hacker
3385 Posts |
Posted - 2012-07-04 : 04:10:08
|
| Not sure that would give you much over the e-r diagram for the database. Then it's just a matter of picking out the objects used.Often the more useful thing to document is the procedural code.==========================================Cursors are useful if you don't know sql.SSIS can be used in a similar way.Beer is not cold and it isn't fizzy. |
 |
|
|
natus
Starting Member
2 Posts |
Posted - 2012-07-04 : 04:20:39
|
| Thanks for your answer! I'm really new with this...Do you have any ideas how exactly I should document the code? Would it be enough to make some comment lines explaining what is going on or is there some documenting standard existing somewhere...? How this is usually done :)? |
 |
|
|
Transact Charlie
Master Smack Fu Yak Hacker
3451 Posts |
Posted - 2012-07-04 : 04:43:18
|
Ideally the code should be readable anyway. It's a declarative language.What's the audience for your documentation?If people will be *using* your object then produce documentation like books online - describing the input parameters and the output data-set.If it is for other developers *working* on your code, only comment pieces that aren't obvious. It's incredibly tedious reading comments that describe what code does that is immediately obvious....For example-- This selects employee details for key @employeeIDSELECT * FROM Employee WHERE [EmployeeID] = @employeeID The comment is completely unnecessary for it's target audience.However if Employee was actually some sort of weird view or materialised data set then a comment like -- Employee is refreshed every 15 minutes, you may not get what you expect!SELECT * FROM employee WHERE [EmployeeID] = @EmployeeID Might not be a terrible comment.It's all down to audience and styleTransact CharlieMsg 3903.. The ROLLBACK TRANSACTION request has no corresponding BEGIN TRANSACTION. |
 |
|
|
|
|
|