sql-server

SQL Server Database

how will i list all the databases in SQL server http://stackoverflow.com/questions/147659/get-database-list-from-sql-server ...

SQL Server 2005 varchar loses decimal places converting to a decimal

Declare @BadDecimal varchar(5) Set @BadDecimal = '4.5' Declare @GoodDecimal Decimal Set @GoodDecimal = @BadDecimal Select @GoodDecimal --Outputs 5 Why? ...

PHP MSSQL character inconsistencies

A very strange thing happens to me when I try to insert Non-Latin characters (e.g. Hebrew, Arabic etc. using N'string to insert') using PHP. This thing happens with all the extensions I've tried: mssql, odbc and native driver. When inserting through PHP code, only when selecting through PHP it works fine and I can read what I've inserte...

Is it possible to programmatically distinguish between versions of SQL Server?

Basically, is it possible to identify if some-one hooks up my program to SQL server Compact or Express Edition? I want to be able to restrict different versions of my product to different versions of SQL Server. ...

Recommendations for SQL Server 2005 IntelliSense tools/add-ins?

I am your average Visual Studio .NET developer who has become dependent on Intellisense and Pre-compile syntax checking. I am looking for similar Intellisense functionality for MSSQL Server 2005 and T-SQL I was wondering what editors or add-ins people have had success with and would be happy to recommend. What key features do you use r...

Documentation for creating a custom SQL Server "Data Source" data provider

I'd like to write an import driver that will allow my proprietary file type to show up in the import wizard "Data Source" dropdown for SQL Server 2005 (or any version of SQL Server, for that matter). I see other vendors who've added their formats to this list - is there documentation for how I would put a driver together? I've searched M...

Retrieving data on separate sql servers

We have a situation where our application calls some stored procedures on a sql 2000 server. Now we must get some of the data from another sql 2000 box connected by a vpn. What would the syntax look like for performing CRUD operations from one sql server to another sql server? Both database servers are SQL 2000 and running Windows 2003...

Query three non-bisecting sets of data

I am retrieving three different sets of data (or what should be "unique" rows). In total, I expect 3 different unique sets of rows because I have to complete different operations on each set of data. I am, however, retrieving more rows than there are in total in the table, meaning that I must be retrieving duplicate rows somewhere. He...

LogParser dropping log entries

I'm importing IIS logfiles into a SQL database but for some reason not every entry makes it into the database. For instance if the logfile has 1,000,000 entries logparser does say that it processed 1,000,000 entries but if I do a SELECT COUNT(*) in the database I don't have 1,000,000 rows of data. Has anyone seen this issue before ? ...

Do I have use the prefix N in the "insert into" statement for unicode?

Like: insert into table (col) values (N'multilingual unicode strings') I'm using SQL Server 2008 and I already use nVarChar as the column data type. ...

Recommendations on using SQL Server GUID from MS Access

I'm upsizing an existing MS Access backend to SQL Server 2008 and, because we want to use SQL Server Merge replication, I'll have to change all current primary keys (currently standard autoincrement integers) to GUID. So here are the questions: Any recommendation on doing the change of primary keys from integer to GUID? Any recommenda...

How to query SQL Server table based on a specific date

I have a table in SQL Server 2005 which has three columns: id (int), message (text), timestamp (datetime) There is an index on timestamp and id. I am interested in doing a query which retrieves all messages for a given date, say '12/20/2008'. However I know that simply doing where timestamp='12/20/2008' won't give me the correct r...

Adding related data with multiple LINQ to SQL DataContexts

Hi: I'm developing a desktop application using Linq to SQL. From what I've gathered, it's better to keep DataContext objects short-lived, but I'm running into the following puzzle: My application has lots of lookup-type data that I'd like to cache on the client. The reason I want to cache it is because I don't want to have to look up...

Multiple Connections With Same Connection String Under A Single Transaction, Elevated Transaction?

When using ado.net, and creating multiple connections to a MS SQL Server database within a single transaction (using System.Transactions.TransactionScope), does System.Transactions elevate the transaction from the lightweight transaction manager to the distributed transaction coordinator (kernel transaction coordinator on Vista), even if...

Help with recursive query

Hi, I've following problem, which I've not been able to do successfully. Your help will be appreciated. I'm using SQL 2005, and trying to do this using CTE. Table has following 2 columns DocNum DocEntry 1 234 2 324 2 746 3 876 3 764 4 100 4 3...

Pattern for very slow DB Server

I am building an Asp.net MVC site where I have a fast dedicated server for the web app but the database is stored in a very busy Ms Sql Server used by many other applications. Also if the web server is very fast, the application response time is slow mainly for the slow response from the db server. I cannot change the db server as all ...

MSSqlSM studio reacts really slowly

My microsoft Sql Server Management Studio is slow. And by slow I mean >1minute to render a context menu-slow. All other things work perfectly fine. The connection to the database itself is not slow (my app works just fine and context menus don't need connection to the DB anyway I guess).. Anybody has any idea what I should check to solv...

SQL Server Authentication or Integrated Security?

We have some corporate intranet users using a WinForms app to work on a system with SQL server behind. Integrated Security is setup, allowing all users update and delete permissions, where application security limits how and where table updates take place. However, some users are power users with SQL query tools at their disposal, and a...

Handling database exceptions in .net

When we can catch an exception like: Violation of UNIQUE KEY constraint 'IX_Product'. Cannot insert duplicate key in object 'Product'. (2627). The challenge is how to dechiper the Index Name IX_Product as a Member (i.e. I don't want to substring out the message). There could be more than one unique constraint on a table and we would n...

MSSQL 2005 Fulltext search setup

I'm beginning my foray into fulltext search for MSSQL2005. This is a new, in-dev database, so I can monkey around with it. Let's say I have a "Form" table that has a one-to-many relationship to two other tables, "Answer" and "Comment." I want the user to be able to enter one search term and have it peg all three of those tables via full...