sql-server

How can I improve SQL server mirroring

Hello (if the question is more appropriate for RackOverflow please let me know) I've setup SQL server mirroring, using 2 SQL server 2005 standard editions. When the application is being stressed, response times increase 10-fold. I've pinpointed this to the mirror, because pausing the mirror shows acceptable response times. What option...

SQL Server how to control access to data between clients on the same database

Hi, We have a system with 2 clients (which will increase). These two clients connect to the same server/database, however neither should be able to see the others sensitive information. There is however some shared non sensitive information. There is also an administrative department who does work on behalf on both of the clients. They...

Backup SQL DATABASE with C# 3.0

How do u backup SQL Server db with C# 3.0 ? ...

Tidy for SQL

I'm looking for a tool that that I can use to clean up (formatting, tabs etc...) my stored procedures and views. Is there anything like html's tidy, but for SQL which is free/open source? ...

What is the best way to store byte array in SQL database using NHibernate?

Hi, I have an array of bytes in my C# class, and need to persist it into a SQL Server 2005 database using NHibernate. What SQL data type should I use for the column, and how do I got about using NHiberante to do the persistance for me? If the answer is a custom NHibernate type, is there any sample code knicking around to do this? Would...

When naming columns in a SQL Server table, are there any names I should avoid using?

I remember when I was working with PHP several years back I could blow up my application by naming a MySQL column 'desc' or any other term that was used as an operator. So, in general are there names I should avoid giving my table columns? ...

How to display the remote sql instances of a particular machine using SMO?

Hi i wnat to display the Remote machine SQL instances using SMO .How to do this one. Suppose i am using the machine machine 1 from this machine i want to display the remote machine(ex machine2) SQL instances using smo how to this ?? i am using SmoApplication.EnumerateSqlServers(true) this dispalys only the local instances. false disp...

SQL Select with WHERE condition, what happens in the background?

Assume I do not have text indexing on. Let say I have: SELECT * FROM myTable WHERE myTable.columnA LIKE 'bobo' Will the SQL engine go through every row and only return those matching conditions or is SQL smarter and does do some hidden native indexing? I'm on MSSQL 2000, 2005, 2008 but if other versions of SQL have different approach...

How to backup SQL Server Agent jobs?

How can I backup and restore SQL Server 2005 Agent job schedules? ...

pass null parameter to SQL server query

How can I pass a null parameter to a SQL server query. I have a simple table with a nullable int column. If I pass a .NET null value, I get a sql error. If I pass DBNull.Value, no row matches the filter. Is there a simple way to do this without using ISNULL. OleDbConnection connection = new OleDbConnection(); connection.Connecti...

How to properly construct SQL subquery in this code?

When I execute the following code, I'm getting results such as: ID column1 column2 34 NULL NULL 34 Org13 Org13 36 NULL NULL 36 NULL Org2 36 Org4 NULL 41 NULL NULL 41 NULL Org5 41 Org3 NULL I want my results to look like: ID column1 column2 34 Org13 Org13 36 Org4 Org2 41 Org3 Org5 I've got two tables: Table1 and Ta...

SQL Server: Find out what row caused the TSQL to fail (SSIS)

SQL Server 2005 Question: I'm working on a data conversion project where I'm taking 80k+ rows and moving them from one table to another. When I run the TSQL, it bombs with various errors having to do with converting types, or whatever. Is there a way to find out what row caused the error? ===================== UPDATE: I'm performing...

SQL - Difference between these Joins?

I should probably know this by now, but what, if any is the difference between the two statements below? The nested join: SELECT t1.* FROM table1 t1 INNER JOIN table2 t2 LEFT JOIN table3 t3 ON t3.table3_ID = t2.table2_ID ON t2.table2_ID = t1.table1_ID The more traditional join: SELECT t1.* FROM table1 t1...

MS-SQL 2005 full-text index on a view with outer joins

I have a view that I'd like to apply a full text index on. It of course needs a unique clustered index to allow for the full text index. Unforunately, I learned that you cannot create an indexed view that contains outer joins. Problem is that my view needs these outer joins! Is there a way to make this happen, or am I going to be stuck...

Is there a way to set a default precision for decimal calculations in SQL Server 2005?

I am multiplying the values of a few decimal columns together in SQL Server 2005 in a stored procedure. The SP already has tens of calculations. The problem is that there's precision being lost. Instead of the result of the calculation having precision of the largest precision involved in the calculation, it's 6 decimal points. I don't...

Using a Cache Table in SQLServer, am I crazy?

I have an interesting delimma. I have a very expensive query that involves doing several full table scans and expensive joins, as well as calling out to a scalar UDF that calculates some geospatial data. The end result is a resultset that contains data that is presented to the user. However, I can't return everything I want to show the ...

tsql- strong passwords

Hi, Using t-sql, how can i find if all SQL Logins have strong passwords on SQL 2000 and 2005 servers? Any help, much appreciated. Regards Manjot ...

MS-SQL 2005 search: conditional where clause with freetext

I'm writing a fairly complex stored procedure to search an image library. I was going to use a view and write dynamic sql to query the view, but I need to use a full text index, and my view needs outer joins (http://stackoverflow.com/questions/1094695/ms-sql-2005-full-text-index-on-a-view-with-outer-joins) So, I'm back to a stored proc...

How to connect to the remote machine using c# and getting sqlserver instances ??

Hi How can i connect to the remote machine and getting the local instances using smo or any thing. using smo i did it for local instances but i dont know the same for remote instances how to do this. (My idea is connecting to the rmote computer and call the EnumAvailableSqlServers(true)) Can u give me ideas to do this??? Thanks in...

How to Retrieve names of stored procedures in SQL Server?

Hi, SO crowd! Is there any way to retrieve the names of the stored procedures by some SELECT from the system table or any system SP? I need to retrieve all the stored procedure names with their signatures (if possible) or just names. I know how to do that in MySql, but similar queries don't work (of course, since all the system DBs na...