I wouldn't do that. It's against the "Rules" of normalization. You don't want to make a row dependant on another row in the same table.
Think of all the fuzz to update the table when you find out someone inserted some wrong data last year, or when HR decides to change the rules (quite probable actually).
So you should make a query that gets you the result you want instead.
Hint, checkout ROLLUP.
CASEWHEN (GROUPING(Leave_Year) = 1) THEN'Total Balance'ELSE ISNULL(Leave_Year, 'UNKNOWN')
SUM(Balance) AS Balance
GROUPBY EmpID, Leave_Year WITH ROLLUP
I haven't tested this code, but it should give you an idea.
I also assumed SQLServer, Different Databases have different syntax. Use Google.
Be excellent to each other. And... PARTY ON, DUDES!
Several screens (or one very functional one) to view the data in a variety of ways like by Phase, by ESXHost, by Application.
I think if we have several drop downs for filtering then that would work; so I can choose Phase 1, to show only the databases that will be migrated in Phase 1, then I can choose some other criteria and the screen shows a subset of data etc.
3. The Pre-requisites and Post-Migration checks should show whether the Phase or database migration is ready to start or is ok to complete.
I require your opinion on what approach is good and/or practical for the following scenario.
There is a web application which queries data from SQL server.
Users report to a manager
1. The process by clicking a button is finding who reports to me (manager)
2. So there is a stored procedure written to find the users reporting to the manager
Now, there is a report (rdlc on the web server displayed via reportviewer control) which takes the manager as an input to generate report data for the staff members reporting to that manager.
The stored procedure for this report uses existing stored procedure (as in step 2 above) to find the staff members reporting to the manager and then generate required data.
My question is:
1. Is this the right way of doing this
2. Is there a need to develop a separate SQL view just for this report
3. What would be the best approach on doing this.
Hi all. I am busy writing a program, in Microsoft Visual Web Developer, and have a database was several tables. The one I am focusing on now is the ACCOUNT table. This table contains username, password and email column.
I want to compare a username entered into a textbox with the existing usernames in the ACCOUNT table, so that I can create a message saying that the entered user already exists.
I know how to do this in C# with if statements, but am really unsure with SQL, since not sure how to use it with SELECT.Thanks
Hi there, I just want to get some opinions on which tool to use to diagram an ER Picture of a DB model having approx 900 tables, but ....
I have tried a few (Erwin, Aqua Data Studio, Powerdesigner and a few more - even tried Visio). All have problems because I just have the tables - no modelled relations (a pretty bad model but that's the fact). A few PK's almost no FK's. All this is in the code layer or even in the head of the developer only. I want to put all this together to graficaly illustrate our data structure.
What I need to get this job done is
- reverse engineer to have a starting Point (Oracle 11 and MSSQL2008) to have all tables in this tool (on a hidden layer if possible)
- Select some tables and copy them (link) to a new layer to switch visibility depending on the development task that i want to give to a developer
- Display compact (square with table Name, and PKs only). Hide all other columns
- a good way to arrange everything on Screen to avoid crossing Relations and to nicely arrange every table and relation
- toggle visibility of a layer
- a certain table appears on more than one layer depending on the development tasks
- something that makes it all "nice" to present to the Boss.
- crow feet Notation
I more search a documentation type of drawing tool rather than a physical modelling. Some of the tested tools started with creating "alter table add column" scripts that immediately change my DB. This is something I dont need.
Any idea out there?
Any tools avail that accomplish this task?