sql-server

Is there a Profiler equivalent for MySql?

"Microsoft SQL Server Profiler is a graphical user interface to SQL Trace for monitoring an instance of the Database Engine or Analysis Services." I find using SQL Server Profiler extremely useful during development, testing and when I am debugging database application problems. Does anybody know if there is an equivalent program for My...

SQL Server 2005 - Export table programatically (run a .sql file to rebuild it)

I have a database with a table Customers that have some data I have another database in the office that everything is the same, but my table Customers is empty How can I create a sql file in SQL Server 2005 (T-SQL) that takes everything on the table Customers from the first database, creates a, let's say, buildcustomers.sql, I zip that f...

Is it OK to drop sql statistics?

We've been trying to alter a lot of columns from nullable to not nullable, which involves dropping all the associated objects, making the change, and recreating the associated objects. We've been using SQL Compare to generate the scripts, but I noticed that SQL Compare doesn't script statistic objects. Does this mean its ok to drop them...

Execute stored procedure (SQL 2005) and place results into a CSV file on a FTP location

I want to get the results of a stored procedure and place them into a CSV file onto a FTP location. The catch though is that I cannot create a local/temporary file that I can then FTP over. The approach I was taking was to use an SSIS package to create a temporary file and then have a FTP Task within the pack to FTP the file over, but ...

SQL Server - Dirty Reads Pros & Cons

Why should I or shouldn't I use dirty reads: set transaction isolation level read uncommitted in SQL Server? ...

Cannot Add a Sql Server Login

When I try to create a SQL Server Login by saying CREATE LOGIN [ourdomain\SQLAccessGroup] FROM WINDOWS; I get this error The server principal 'ourdomain\SQLAccessGroup' already exists. However, when I try this code DROP LOGIN [ourdomain\SQLAccessGroup] I get this error Cannot drop the login 'ourdomain\SQLAccessGroup', because it...

How do I create a mapping table in SQL Server Management Studio?

Hi - I'm learning about table design in SQL and I'm wonder how to create a mapping table in order to establish a many-to-many relationship between two other tables? I think the mapping table needs two primary keys - but I can't see how to create that as it appears there can only be 1 primary key column? I'm using the Database Diagrams ...

Batch file to "Script" a Database

Is it possible to somehow use a .bat file to script the schema and/or content of a SQL Server database? I can do this via the wizard, but would like to streamline the creation of this file for source control purposes. I would like to avoid the use of 3rd party tools - just limiting myself to the tools that come with SQL Server. ...

Accessing Excel data source running SSIS package on 64 bit server

Hello, I have an SSIS package that exports data to a couple of Excel files for transfer to a third party. To get this to run as a scheduled job on a 64 bit server I understand that I need to set the step up as a CmdExec type and call the 32 bit version of DTExec. But I don't seem be able to get the command right to pass in the connectio...

In SQL Server, how do I generate a CREATE TABLE statement for a given table?

I've spent a good amount of time coming up with solution to this problem, so in the spirit of this post, I'm posting it here, since I think it might be useful to others. If anyone has a better script, or anything to add, please post it. Edit: Yes guys, I know how to do it in Management Studio - but I needed to be able to do it from wi...

Good Starting Places for SQL Server Alerts/Notifications?

Just recently started having issues with a SQL Server Agent Job that contains a SSIS package to extract production data and summarize it into a separate reporting database. I think that some of the Alerts/Notifications settings I tried playing with caused the problem as the job had been running to completion unattended for the previous...

How do I display records containing specific information in SQl

How do I select all records that contain "LCS" within the title column in sql. ...

Using cached credentials to connect to SQL 2005 across a domain boundary

Ever since moving to Vista some time ago on my development machine, connecting to SQL Servers in our DMZ active directory domain from client tools like SSMS has not worked like it used to. In XP, as long as I had authenticated in some way on the server (for example directing Explorer to \server.dmzdomain\c$ and entering valid creds into...

SQL 2005 Book For Optimization Techniques

My knowledge of SQL has been mostly gathered through immediate need as opposed to formal training. The project I'm working on now requires the next level of SQL (specifically SQL Server 2005) knowledge. That is, I need to know techniques for optimizing the schema, writing optimized queries and even some information about replication an...

What's a good way to check if two datetimes are on the same calendar day in TSQL?

Here is the issue I am having: I have a large query that needs to compare datetimes in the where clause to see if two dates are on the same day. My current solution, which sucks, is to send the datetimes into a UDF to convert them to midnight of the same day, and then check those dates for equality. When it comes to the query plan, thi...

Is there an open source SQL Server DB compare tool?

I'm working on an open source project that uses SQL Server 2005 as the data store. We need a DB compare tool to generate diff scripts to be able to upgrade a DB from one version to another. Is there an open source or free SQL Server DB diff tool out there that generates a convert script? ...

What is the best development environment for TSQL / SQL Server

Just curious if there are better tools out there for sql server development. We currently use the standard MS stack . . . SSMS with the addition of Redgate's SQL Prompt (which rocks...most of the time). Are there others? Are there better tools? ...

Detecting if SQL server is running

I'm looking for a way to poll different servers and check that SQL server is up and running. I'm writing my code in C#. I don't particularly care about individual databases, just that SQL server is running and responsive. Any ideas? ...

ASP.Net: How to do pagination with a Repeater?

I'm using the Repeater control on my site to display data from the database. I need to do pagination ("now displaying page 1 of 10", 10 items per page, etc) but I'm not sure I'm going about it the best way possible. I know the Repeater control doesn't have any built-in pagination, so I'll have to make my own. Is there a way to tell the ...

Any good tools to automate SQL Server management tasks?

I know I could write scripts and create jobs to run them, but at least some of what I'm wanting it to do is beyond my programming abilities for that to be an option. What I'm imagining is something that can run on a regular schedule that will examine all the databases on a server and automatically shrink data and log files (after a back...