sql-server-2008

SQL Server 2008 Unique Column that is Case Sensitive.

Is there a way to make a column both UNIQUE and Case Sensitive? I want to be able to put abcde and ABCDE in a unique column. ...

SqlConnection.ClearAllPools issue

Hello everyone, I am using VSTS 2008 + .Net 3.5 + C# + ADO.Net + SQL Server 2008 Enterprise. I am learning http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqlconnection.clearallpools.aspx about SqlConnection.ClearAllPools method. I want to know the behavior of this method is, if any connections from connection pool is idle...

running sql server 2008 on windows 7 and setup its sp problems

I installed sql server 2008 on my windows 7 rtm, but as you see in the screen shot all its services are stop and when i try to start it fail, also when i try to install SP, it give me a big error message. Is it not possible to install sql 2008 on windows 7 or what should i fix? feel free to ask me to know more about the problem. ...

How to assure that certain data in SQL Server 2008 can only be accessed with my software?

I’m distributing an SQL 2008 database with my c# application (only the data, which I restore in the client’s local SQL server). Is there a way to assure that the client can only access my data by using my application? (and not, for instance, using Management Studio, SQLCMD, etc) Thanks, Nestor ...

How to find the port for MS SQL Server 2008?

I am running MS SQL Server 2008 on my local machine. I know that the default port is 1433 but some how it is not listening at this port. The SQL is an Express edition. I have already tried the log, SQL Server Management Studio, registry, and extended stored procedure for finding the port. But, I could not find it. Please help me. Thanks...

A single sql query which can handle both null or valued date range in sql server

Using SQL Server 2008. I have a stored proc which has start and end date as input parameters for date range. Looking for a single sql query which has a between start and end date in the where clause which can handle both cases where the dates are either both null or both have values. I don't want to use an IF statement. ...

How can I select the first day of a month in SQL ?

I just need to select the first day of the month of a given datetime variable. I know it's quite easy to do using this kind of code : select CAST(CAST(YEAR(@mydate) AS VARCHAR(4)) + '/' + CAST(MONTH(@mydate) AS VARCHAR(2)) + '/01' AS DATETIME) but this is not very elegant, and probably not very fast either. Is there a 'better way t...

how to reseed table to start at the PK 2?

how to reseed table to start at the PK 2? (SQL Server 2008) ...

Enforcing effective dated records in sql

Suppose I have a record with a column called "Name". Each record can be effective dated, so I also have an effective date and an expiry date column. The "Name" column has to be unique, but only within overlapping periods of the effective date and expiry date. I'm looking for some sort of efficient way to enforce this from within the s...

Read WMF image from SQL Server

I am using a SqlDataReader and I am trying to read from a table I converted from an Access file, and is in SQL Server 2008. The datatype is now a varbinary(max). How do I convert this, so I can have it as System.Drawing.Image? It is a Windows MetaFile and I want to convert it to a PNG or GIF and save it to the filesystem. It appears ...

insert into sql server data base from html controls

i have a <h1> that has a news title in it and i want to insert the content of this <h1> into sql server 2008 database how can i do this using c# ...

SQL Server 2008 data types

What are the different SQL Server 2008 data types? I am specifically trying to find the equivalent of a long int. ...

SQL Server 2008 Copy Database Wizard: Fail

I am trying to use the SQL Server 2008 Copy Database Wizard to copy a SQL Server 2008 database. I am using the SQL Management Object method. The database contains a full-text index. I have set the 'Server - Properties - Advanced - Full-Text Upgrade Option' to Reset. However, the copy fails with the following error: ERROR : errorCod...

-S unknown option when using sqlcmd

I get an error when I execute the command below from a DOS window in Windows XP with SQL Server 2008. -S is the option to specify the server name. error: Sqlcmd: '-S': unknown option. sqlcmd –S localhost –d databasename -i C:\files\somefile.sql –E ...

SQL Server 2008 - Add Windows Account After Deleting Default User

This is rather embarrassing, but I accidentally deleted my Windows account from the list of SQL Server 2008 users and I cannot for the life of me figure out how to re-add myself now that I don't have login privileges. The server is running on my machine and the only other Windows users with access are IUSR, NETWORK SERVICE and SYSTEM. ...

Database trigger is recurising :( How to prevent this?

Hi folks, I've got the following trigger on a table for a SQL 2008 database. It's recursing .. so i need to stop it. After I insert or update a record, I'm trying to then update a single field on that table. Simple. Here's the trigger :( ALTER TRIGGER [dbo].[tblMediaAfterInsertOrUpdate] ON [dbo].[tblMedia] BEFORE INSERT, UPDA...

SQL Server authentication in SQL Server 2008

I created a login with SQL authentication credential in SQL Server 2008. But, I am not able to login using that credential. We followed the same steps in SQL Server 2005 and working without any problem. What could be the problem? Thanks, P.Gopalakrishnan. ...

Raise an error manually in T-SQL to jump to BEGIN CATCH block

Is it possible to raise an error in a stored procedure manually to stop execution and jump to BEGIN CATCH block? Some analog of throw new Exception() in C#. Here is my stored procedure's body: BEGIN TRY BEGIN TRAN -- do something IF @foobar IS NULL -- here i want to raise an error to rollback transaction -- do something next C...

Differences when convert between Geometry & Geography instances

Hi there, Using SQL Server 2008: assuming I have a valid geography object geog1, converting it to a geometry instance geom1 (using the same SRID) and converting it back to an object geography geog2 shows no difference between geog1 and geog2. However, due to a problem already discussed here I cannot create a geography object containing...

SQL Server 2008 debugger

Using the SQL Server 2008 debugger, how can I see the contents of a local table-valued variable in a stored procedure? In the locals window its value is listed as "(table)", but I can't see the contents. I saw some references to an "Immediate" window at http://www.sqlservercentral.com/articles/SQL+Server+2008/64354/ (note registration re...