sql-server

How do I map (local) to a non-standard named SQL Server?

I installed SQL Server 2008 (SQL Server 2005 was already installed) on my XP box and name the local instance of the database so that it wouldn't clash with SQL Server 2005. Now I want to change the mapping of (local) from SQL Server 2005 to my non-standard named SQL Server 2008 instance. Anybody know how to do this? ...

SQL Server 2005 deadlock on key

I have a table with a clustered primary key index on a uniqueidentifier column. I have a procedure that runs the following psuedo functions: begin transaction read from table 1 insert into table 2 update table 1 with pointer to table 2 record commit transaction This all works fine until the same procedure is executed concurrently from...

SQL Server 2005 - Enabling both Named Pipes & TCP/IP protocols?

We have a SQL Server 2005 database, and currently all our users are connecting to the database via the TCP/IP protocol. The SQL Server Configuration Manager allows you to "enable" both Named Pipes, and TCP/IP connections at the same time. Is this a good idea? My question is not whether we should use named pipes instead of TCP/IP, but a...

Setting up the default AspNetSqlProvider to point to remote database

When starting a new project that required the use of membership providers I found that I could not connect to a remote database that contained the membership database. I ran aspnet_regsql and was able to create the membership database on the remote server but when I go to ASPNET Configuration (cassini development server) it will not con...

Affordably hosting a web app with a 10GB SQL Server database?

One of my clients is developing an ASP.NET application that will be dealing with large amounts of data. The initial size of their SQL Server database will be at least 5GB and could grow to 10GB within a year or so. Most web hosting companies we've looked at charge $5/month for every extra 50MB of database, after the first 1GB or 2GB. ...

Do i need one or two Unique Key Index's for this table?

Hi folks i'm trying to create a Users table that only has OpenId registrations, exactly like StackOverflow. I'm storing in the table OpenId Identifier (their login name) Alias (which is the display name to show to the public) Some other openId stuff So .. I want make sure that there is only ONE user in the system that has the open ...

Saving OpenId fields to a database - what are their types/lengths?

Hi folks, I'm wanting to save some OpenId fields to a database table, such as OpenId identifier Full Name Alias Email etc.. is there a place that summerizes the datatypes and lengths for all the common schema fields? I know there are custom ones (per provider) .. but what about the common ones? Eg. email -> nvarchar(250) .. or some...

SmallDateTime Default Format Problem in SQLSERVER 2005

Hi, i am new in SqlServer.When i insert 07.12.2008 12:34:00 into my smalldatetime type column,it is inserted but when i select it in query analyzer,i see it as 2008-12-07 12:34:00.How can i change default format of that column? ...

How to transform rows to columns

I have a simple problem when querying the SQL Server 2005 database. I have tables called Customer and Products (1->M). One customer has most 2 products. Instead of output as CustomerName, ProductName ... I like to output as CustomerName, Product1Name, Product2Name ... Could anybody help me? Thanks! ...

dd.mm.yyyy hh:mm format in Sql Server

Hi, I looked at SQL Server dateformat codes but I couldn't find dd.mm.yyyy hh:mm format in the list. German Date Format(Code is 4) works for me but it doesn't contain hh:mm. Does someone know this format's code? ...

How to automate SQL backup on a shared hosted server?

I'm using a hosting service which allows me to backup my SQL 2008 database and download the BAK file via a web interface only--and I have access to the database via Management Studio. I can execute the backup command from Management Studio,but I don't have rights to the path where the backups are located. Is there any way via SQL or scri...

Getting week number off a date in MS SQL Server 2005?

Is it possible to create an sql statement that selects the week number (NOT the day of week - or the day number in a week). I'm creating a view to select this extra information along with a couple of other fields and thus can not use a stored procedure. I'm aware that it's possible to create a UDF to do the trick, but if at all possible ...

Remote Computer Name in SQL Server

I have an app that run on many computers and connect to sql server I want to log the machine names of that computers in a table every time they connect how can I do that I want to know if there is a command like that "Select @@MachineName" ...

How to change the base type of a UDT in Sql Server 2005?

I have my type "x" of type varchar(50). How can I alter it to varchar(100)? It seems I can't! ...

Can a sql server table have two identity columns?

I need to have one column as the primary key and another to auto increment an order number field. Is this possible? EDIT: I think I'll just use a composite number as the order number. Thanks anyways. ...

Single User: Turn off locking for Microsoft SQL Server

I'm running an upgrade script against a database hosted in Microsoft SQL Server. It's taking a while. Some of the queries are not worth optimising any further, for various reasons. I'm the only person using this database: Is there a way that I can tell SQL Server to not bother with transactions/locking? For instance, on a DELETE ... WH...

SQL Server: PRINT output doesn't appear immediately

In SQL Server 2005 Management Studio, it appears that the output of PRINT statements doesn't appear immediately: If I have a PRINT statement followed by a long-running statement, the PRINT output doesn't appear until after the following statement. Is there any way to flush the output earlier? I'm running some upgrade scripts that take a...

SQL Server: Upgrading databases

We've got a product that uses a Microsoft SQL Server database. We've got customers using various older versions of the product. How do people write/structure their database upgrade scripts in this situation? ...

Schema changes not updating in Intellisense in SQL 2008 (SSMS)

I've notice an issue - it feels like a bug but I suspect a 'feature' - in SSMS in SQL Server 2008. I have various tabs open, for example an alter table script in one table and a SProc that queries that table in another tab, and when I execute my Alter Table script the changes are not reflected in Intellisense in the other tab. I can cr...

SQL Server history table - populate through SP or Trigger?

In my SQL Server backend for my app, I want to create history tables for a bunch of my key tables, which will track a history of changes to the rows. My entire application uses Stored Procedures, there is no embedded SQL. The only connection to the database to modify these tables will be through the application and the SP interface. Tra...