sql-server

Huge Transaction Log - Is This Normal?

I have a 5GB database and a 20GB transaction log (SQL Server 2005). Not sure why it is so large or what happened to make it that large, it used to be around 1/2 the size of the DB. DB grows about 1GB/month. Are there any guidelines to how how big your transaction log should be relative to your database file size? EDIT: I'm not saying...

Remote connections into sql08

Hi, Does someone have a link where I can read on how to access my remote server's sql server '08 installation? update I want to access sql server 2008 from management studio on a remote server. Remote access is disabled by default! ...

What is your SQL Server Backup/Maintenance Plan?

As a followup to this question I'm wondering what your SQL Server backup/maintenance plan is, and how I can make mine better. Currently I'm running two plain-jane maintenance plans from the plan wizard. The first runs nightly and does just about everything ... Full database and transaction log backup integrity check, rebuild index, r...

Log table access using SQL Server Profiler

Is there a way to use Profiler to determine whether a table is being accessed by queries? I saw an event named Object:Opened (Indicates when an object has been accessed, such as for SELECT, INSERT, or DELETE statements) and Object:Closed, but these do not seem to work. In particular, I created a simple trace with both Object:Opened and...

Partial Keyword Searching (MS SQL 2005)

Current, I've got a stored procedure that has a main goal of doing a full text search through a database table of films and tv shows. In order to get it to do partial-keyword searching, I added some code in SQL to split up the search query by spaces, and output a statement like the following: ' "batman*" ~ "be*" ' The original string,...

Way to tell SQL Server to only cache certain types of adhoc queries

Is there a way to tell SQL Server to not cache certain types of plans? For example, if you have a large number of users queries coming from SQL Server Management Studio, is there a way to tell these to not be cached in the plan cache, thus taking up memory and other resources? Are there other behavioral tweaks that you can do to preven...

Update script for updating a table field in SQL Server from NULL to non-NULL

I have a field (say, foo) in a table in a SQL Server database that was originally defined as nullable, but new requirements indicate that this field must be non-null. What's the best way of updating this field to non-null via an update script without deleting the contents of the table? I tried generating a script from the Design view, ...

SQL Server 2000 Page size and the NTFS page size

In the Oracle world, it's been gospel to build your database block size to be even multiples of the File system's block size. I assume this is still true but I'm not adverse to being told why technology has made this irrelevant. But I've been told some SQL Server DBA's are going to upgrade the OS of a SS2000 installation to 64bit to get...

MS SQL Trigger update call dead lock?

I have two tables. Club and Coach. Between them is 0,1 - 0,1 relationship (coach can have zero or one club. club can have zero or one coach). When I want to change the coach of the given club, i have to update the club table. So i have to change idCoach of that club. Lets consider a new coach (the newly assigned coach of the given club) ...

How do I restore a single table from a SQL Server 2005 backup?

I've got a backup made using the regular SQL Server 2005 backup command. Is there a way to restore just a single table, not the whole DB? ...

ASP.NET Long Running SQL Server Procedure - How to handle? Messaging?

I have a web application that needs to fire off a long-running SQL Server procedure (to rebuild a table) when certain criteria are met. What is the recommended procedure to do this? I was thinking, when the criteria are met a record would be inserted into the database and a scheduled SQL server job would check that table at a specified ...

Nullable Property Causes Errors When Null in NHibernate

I have a property defined in my HBM file like this: <property name="OwnerId" column="OwnerID" type="System.Int32" not-null="false" /> It is defined as a nullable field in the database also. If a record in the DB has the OwnerID column set to an integer, this object is correctly loaded by NHibernate. But if the record has it set to n...

Provisioning SQL 2008 Database with C# Application

Hi all, I have an internal enterprise application I've developed for my company built on .Net 3.5 / SQL 2008. I have two types of databases. The main system database which contains all of our global data, such as user names, and customers, etc. And project databases, which contain the actual data pertaining to our clients project. ...

Can the DMV views get reset without kicking eveyone out of the db?

I have seen posts that show three ways to reset the DMV views: Reset the SQL Service Detatch the database Close the database All of these methods seem to require taking the system off-line for a few moments. Is there a way to reset the statistics on demand without interrupting use of the database? When we have odd performance issue...

How do I verify that my LINQ-to-SQL model matches the database schema?

I am absolutely new to the .NET world, and started with C# on friday. I have some experience with database apps, though. We will go with LINQ-to-SQL for a medium scale project. I am used to generating my schema from classes and keep track of changes with subversion and equivalents to Ruby's Migrations. There obviously is no easy way to ...

Convert NVARCHAR to INT skipping non convertibles

I need to query a database which is designed so what a NVARCHAR column keeps age of clients. I want group clients using GROUP BY age / 10 but when engine encounters some string like '20.10.1984' (someone entered his bithday instead of age), my query fails. The percent of "bad" ages is very small, so I want just to skip records which ...

How to bulk-amend the job step command in ALL sql server agent jobs

I have many jobs that have a step to send 1 specific email out to a list of people. That list of reciepients is hardcoded in the step command and I need to remove one person from that list, in all jobs. How do I loop through ALL the jobs in the Sql Server Agent and modify the command text to find+replace a specific piece of text. I ...

Transactional replication

What is the maximum number of publishers one can create on one Database on that same database server itself? Also, Vice - versa , What is the maximum number of subscribers one can create on one Database on that same database server itself? ...

Imitating SQL Server Profiler in a C# app??

I want to create a trace on a database server from my C# app, like what you do in SQL Server Profiler. I have found stored procedures (sys.sp_trace_create etc...) that dont seem to work for my SQL management studio. I was wondering if anyone could help with the coding, or where i would start to do this?! ...

Sql Server Dependencies

Is there an easy way to chase down table/stored procedure/function dependencies in Sql Server (I'm using 2k5)? I've inherited a giant application with lots of tables and even more stored procedures and functions that are long and interlinked. At the end of the day is there a way to build a dependency tree? Ideally what I'm looking f...