How do I monitor how much time I'm spending on SQL Server? - sql

Is there a table on MS SQL 2005 or 2008 servers that will show my boss how much work I'm doing?
Maybe something that would show how often my database tables/views/etc are being executed/queried against?

I would probably look at setting up a trace. You can read up on Data Access Tracing here.
Once you are done doing that, write a script that makes it look like you are working 24 hours a day and ask for a raise. Seriously if your boss is using your query history to determine how much work you are doing he is:
A real ball buster
Clueless

Get Mladen Prajdic's SSMS Tools Pack. It can keep a running history (in a database, on the local file system, or on a network share IIRC) of queries you are working on and/or executing, and you can customize how often it auto-saves for you. It won't tell you how much time you spent staring at the screen between edits or reviewing query results, but it should be a start.

Short answer: No.
There is nothing built in and immediatley avaliable within SQL Server that does this. There are any number of ways such functionality can be implemented, but none are simple or trivial, and a skilled DBA could run rings around 'em anyway.

This is what I use for looking up on what I have done during the day. This will be applicable to you ONLY if the the window title of whatever software, changes depending on what you are currently working on.
Eg: My Awesome SQL Software - Query1.sql
My Awesome SQL Software - newQuery.sql
My Awesome SQL Software - Results of Table 1
Manic Time will track individual applications + their window title.
http://www.manictime.com/

Related

SQL Server Back End, Front End?

Ok so this is my first question on this site so please bear with me.
My problem is that our company is currently changing from access to an SQL database back end and I was given the job to design a front-end for non programmer users to just pull pre-defined queries or build a query of their own by just selecting the fields they want (dynamic query).
What I want to know is what would be the simplest way to go about doing this due to the fact that I have a some programming background but I wouldn't say I'm an advanced programmer.
I've done some searching over the last couple days and came across things such as Ruby on Rails and phpMyAdmin however before I take on the task of learning how to program with these tools I want to know for sure if I am going in the right direction before wasting my time on a pointless endeavor.
I've seen similar questions even on this site however none truly gave the answer I was looking for; any help will be much appreciated.
Also would it be easier to make this web-based?

How do I create queries to SQL Server tables via Visual Studio when no knowledge about SQL nor Linq?

Let´s be frank, my knowledge regarding SQL language is very low.
Nevertheless, my boss gave me the task to build a database application using the following tools: SQL Server and Visual Studio 2008; C#. I use the VS DataSet as a local mirror of the SQL Server.
And let´s be frank again, my understanding of the VS Query builder is also very small, I´m finding it quite confusing, actually. So no help to find from Query builder.
And my knowledge of Linq is even lower...
Perhaps I should mention that the deadline for the project is "aggressively" set, so I have no chance to learn enough about these things during the project. And I´m a bit stupid too, which is no help when it comes to challenges like this (on other occations it might be quite useful though)
With these permissions, what should I do (except for killing myself or retire) to be able to query my tables in a sufficient way?
Start learning. Look for another job at the same time. Obviously your boss is an idiot - giving you tasks to be not qualified for (or the story is a little different - would not be the first "specialist" trying to find employment that is clueless).
Sorry, I really dont know what else to say here - if yo do not know how to do your job, learn. If that does not work, then you can not do your task. Simple like that.
SQL Query takes a day to get started (on a beginner level). If you do not have this time - get your boss hire someone who has the knowledge.
keep a c# reference book handy. Also a book on sql or you can use sql books online. You can always google for your specific problem or use a forum to get answers. Be optimistic, quit whining and get to your task. All the best.
what type of task you want to do in SQL ? define in Detail.
and start working on the sql it's easy to understand.
there is a visual query designer in visual studio. that might be helpful. Open up server explorer, right click and existing database connection or create a new one and then right click to select 'New Query'.
In the query designer, you can add table and visually add conditions for joins, aggregates etc. and see the query being formed.
Use MS Access:
Start up Access, create a new DB.
Import your SQL Server DB to your new Access DB.
Select Create tab -> Query Wizard -> Simple Query Wizard (and it IS simple to use).
When the query is created, you can use the SQL code in your original SQL Server based application - but as SQL Server and Access aren´t 100% aligned, you might need to do some adjustments - google it up. Here is however a good page that will help you out.
Bonus is that it´s a good way to learn SQL "on the fly".

getting started with microsoft sql products

yesterday i went for an interview to be a sql / .net developer. my experience with sql is limited to basic pl/sql with oracle. they drilled me "do you know ssrs, do you know tsql, etc" well i kept saying no because i havent worked with them.
question: what do i have to learn in order to be able to work with microsoft sql? is it really that much different than oracle?
Grab a copy of SQL Server Express (see here) and start playing with it. There are sample databases that you can download to get you started.
SQL is the same, as it's a standard. T-SQL is an add on that has some flavors that are helpful to know. The way you setup procedures, functions, etc. is also different than PL-SQL, so that would be good to read up on. Outside the SQL Server engine and the various built-in tools, there are a lot of other MS products:
SSRS - SQL Server Reporting Services features a reporting engine, which are developed in Visual Studio.
SSIS - SQL Server Integration Services is a data import/export, etc. process, it's very handy to use for data import/export and other batch processing
SSAS - Analysis Services for OLAP
And so on. I don' tknow that SSAS helps you in this regard, but SSRS is pretty big so as a developer, reporting is a key feature and that would be handy to know something about. SSIS is good to know a little bit about, but might not be that handy, depending on what the org's needs are.
HTH.
SQL is pretty much SQL. There are some engine-specific differences but for most apps they're not significant. The management tools are obviously different. The OOB tools are vastly different.
SSRS is a reporting package (think Crystal reports on double steroids and you'd be close) not a DB engine. That should be listed as a separate job requirement.
I'd say get an MSDN license OR the free trial for SQL Server and install them all and try them out. Bookstore is a fairly generic app that you can extend forever and tryout new things.
Just keep in mind that someone hiring you is still going to want actual app experience, not your trials. If you can't get it at work, volunteer at an organization.
A good place to start is reading the MSDN SQL Server resource page. You'll find good information there about the whole MS SQL Ecosystem.
Then get a trial license, a virtual machine and start playing around.
It's kinda limited to their knowledge, as if you know basic ANSI sql then you can get almost all the basics running on SQL Server as they have a common base. As for SSRS, that is specific and will require reading and playing with it to learn. The SQL2008 Express with Advanced services should help you out.
With .net developer interviews I've been to they expect you to know the basics at minimum and be able to do joins and stuff in sql. Learning how to do temp tables and stored procedures as well as updates/selects/deletes and stuff should get you a bit further.
Potentially if they want that kinda experience either they are aiming the roll too low, or you've managed to slip through the net for a higher level role (which is sometimes a good thing) :-)

Data synchronizing with SQL Server Management Studio

I was just about to buy redgate.com's compare package when I came to realize it seems highly unlikely a task like this isn't something that can be performed from the Management Studio.
I have a development database and I have a live database.
I develop my application adding stored procedures, correcting small things in the data structure and maybe add some new tables.
Now I want the changes added to the live server. As it is unlikely I have kept 100% track of all of my changes I would of course like if it just new itself what I have changed.
Does anyone know what's best practice in Management Studio for this task? I mean it must be a task we all gets confronted with in larger projects.
If you do it with management studio it's all restricted to your own head. YOU will have to keep track of all the changes etc. I find that Redgates SQL Compare 8 and SQL Data Compare 7 does the trick. I recently moved the structure of a production database over to something totally different within minutes thanks to Redgate.
I have earlier tried to use Management Studio but it does not perform very well at complex tasks.
You really should be keeping your database schema in version control along with your source code.
What's wrong with it not being in the IDE? It has its own interface.
This tool save me hours a day. Not only because I dont HAVE to remember everything, but I then dont have to fix the production server if I missed something. I can work on multiple systems and push updates to each of them in a 10th of the time it would take me in the Management Studio.
This tool is by far the best 3rd party tool ive used for sql server. Its a godsend. A cheap one at that.
Just dont have the arrow pointing the wrong way ;-)
Okay I just bought Redgate :)
I have worked with it before so i can only agree that it is state of the art, I was just stunned to realize that Management Studio don't have anything that corresponds to this.
Thanks for the great answers!
Stackoverflow really is the pleace to ask these kinda things.

MySQL versus SQL Server Express

Did the recent purchase of MySQL by Sun and the subsequent buggy releases kill the MySQL brand?
I whole heartedly embraced MySQL when it first came out as I used to be a poor developer and all the RDBMs were too expensive. I have fond feelings for MySQL and their being able to compete with Oracle and SQL Server. I credit the original MySQL team for the existence SQL Server Express. I now use SQL Server Express instead of MySQL for just about everything. First, I do not like Sun and second, SQL Server Express is significantly more robust and 'Enterprise' than MySQL.
The only significant limitations on SQL Server Express are the 4GB db size and the lack of Agent. I find that the size limit is not a concern because by the time the db gets close to that size, the application should either be profitable (and you buy the license), or you should kill the product. The Agent issue is a nice to have, but not critical as you can work around it.
It seems that for db simpletons like me, SQL Server Express is easier to setup and use and is faster and more stable. And for gurus, they will use PostgresSQL...
Resolved:
So basically, we have a bunch of SQL Server fans (albeit open-minded) on stackoverflow. It looks like I'm in the right place. It's sad to see MySQL transform from something you cheer to something you pity. I hope the founders of the original company try a new endeavor. I absolutely do not judge them for selling to SUNW - work is naturally profit driven. I hope we get some people with FU money who don't care about profits who create some products like MySQL used to be. Othewise, MSFT might take away EXPRESS.
Having worked with both, I have to say that the limitations and/or bugs in MySQL were a big turn off for me... I don't like PHP, and while I respect the open source community for their advances with these two technologies I just can't see the elegance in the way either of them have been put together. But don't let my personal taste sway your judgement against MySQL.
I do all of my prototyping in SQL Server Express and most of my clients use full blown SQL Server 2005. The ease of transition from one to the other makes it a no brainer for me - I can take anything I wrote for SQL Server Express and put it straight in without worrying that the syntax might be different. The two limitations don't even really get in the way in a dev environment - it's only when you come to production that they would tend to be a problem.
For me, SQL Server wins the argument hands down.
So far no-one knows what Oracle is going to do to MySQL, not even Oracle.
I've done extensive testing of MySQL and would say that in terms of performance it is about at SQL Server 7.0 level. That is fine if all you need is the performance of SQL Server 7.0
At the enterprise level is simply doesn't compete. If you look at the fanfare surrounding MySQL 5.4 it says "now supports more than 4 processors".
Where MySQL scores highly is that it is so cheap that it makes a scale-out design feasible, in which case the raw power of an individual box simply doesn't matter.
There are quite a few ommissions in MySQL that will trap a SQL Server developer. No CHECK constraints, no index views, no separation of clustered indexes from primary keys. That said, it has a large number of useful features that are very useful to web developers.
The Sun/MySQL guys are remarkably honest about their product. They say exactly what the strengths and weaknesses are. If you are used to some of the big vendors sales tactics this comes as a massive shock. Ultimately this does inspire confidence in using the product because you know exactly what to expect. I would much sooner deal with a product that says "don't do this because this is beyond our limits" than one that says "our product is the cure for cancer" and it turns out it couldn't cure a simple hangover!
Having run both*, I don't think there's much question that SQL Server is overall a more full-featured product than MySQL (although I'd be interested to hear arguments to the contrary).
I wouldn't be overly concerned with MySQL bugs - just run a few releases behind.
Given that you have a Windows server, the only issue I can see is the prospect of acquiring a significant cost if you max out the resources permitted with Express and need to go to a full, licensed SQL Server 2005 (or 2008) instance. If you expect to scale to that level and can't afford the licence, then a free DBMS would seem to be the smart move now, and I'd also look at PostgreSQL, which may be a better alternative.
* and liked them both for different reasons, FWIW
This is a very old article. With MySQL 5.7.20 now, there is no reason to use MS SQL Server or any other commercial licensed database. We switched to MySQL for our high profile financial .Net app six months ago after getting tired with over $50K licensing cost for MS SQL server and this was the best decision ever. No licensing cost and MySQL is highly configurable, small foot print, performance better than MS SQL servers. So far no glitches, no issues. Replication is easy to setup and works like a charm. Did I mention, no money even when running on a 32 core server and having five replication server. MS SQL server costs $3000 per two core (in our setup this would come out to be in six figures). Pure stupidity to throw that money out for nothing. Our own benchmarks, MySQL is performing better than MS SQL server. We really like easily configurable events in MySQL in addition to it being free. Just one another point, it takes only a few minutes to install MySQL while it takes forever to install MS SQL server on a new computer. Don't know what MS SQL server needs to do for hours while MySQL zip file can be unzipped and two line command can configure it within minutes.
MySQL is still going strong, and will continue to.
Note however that SQL Server Express is limited in other ways; specifically, number of CPUs and limitation of RAM usage (1 GB).
Personally I prefer SQL Server over MySQL. It is much easier to work with. And applications properly developed for it can scale to enterprise level if you are careful.
I don't think that you liking Sun or the mySQL 'brand' should influence your choices too much - unless you feel mySQL will be run into the ground by Sun. Look at the performance, management and features.
SQL Express with advanced features looks interesting - now has reporting services. SQL Express also requires a windows license and any associated licensing you might need.
mysql could use http://jasperforge.org/ for reporting.
I like writing tsql more, but for any independent projects, I would likely use mysql due to its cost savings that could be passed on to the client - putting me above the competition. People like saving money, even if it is profit.