sql-server-2008

Using database default values with Linq to SQL codewise

I am using Dynamic Data with linq to SQL and SQL Server 2008. I have a GUID column that gets his value from the default value with newguid(). When I set IsDbGenerated to true in the designer it works like a charm. But when I renew table this property is set back to false again. So I added it to the metadata. For some reason it's not ...

How can I use SQL Server's full text search across multiple rows at once?

I'm trying to improve the search functionality on my web forums. I've got a table of posts, and each post has (among other less interesting things): PostID, a unique ID for the individual post. ThreadID, an ID of the thread the post belongs to. There can be any number of posts per thread. Text, because a forum would be really boring ...

SQL Server 2008 intellisense no longer working

Hi all, I installed SSMS Tools and now my intellisense isn't working. Is there a reset settings, like for VS (devenv /resetsettings)? ...

Help with SQL query

Hello, I have list of DateTime values, and for each value I need to fetch something from the database. I would like to do this with one query. I know it's possible to pass a table (list) to the stored procedure, but Im not sure how to write the query itself. Let's say I have the following table: CREATE TABLE Shows( ShowId [int] N...

SQL Server Management Studio hangs on 100% during recovery

Hello, I want to restore a bak file in SQL server 2008 (the backup was created on a SQL server 2005). I set the recovery to WITH NORECOVERY, as I want to apply further transaction logs later. Meaning: the database should stay in restore mode, but the recovery-dialog in the management studio does not finish ever. It shows 100% for nearly...

Whiel Update ,datetime value is rounded to seconds.! i want milliseconds too

Hi friends, While updating a datatime column in a table from another table, i noticed that mnilliseconds value are not shown.. instead it is rounded and the value is updated to nearest seconds. Example : Original Value: 2008-06-26 14:06:36.643 Updated Value : 2008-06-26 14:07:00 Please help me getting the actual value including mil...

Quetion for tangens re MS SQL Server and Select for update

Hi Tangens, Did you find a way around the select for update limitation for MS sql server? I need the exact same behavior as what you were looking for and was wondering if you found something. ...

Reporting Services Exporting Problems

I'm working on a Microsoft Dynamics CRM Quote with a separate header report and sub report. The sub-report has a detail grid of what is quote, a terms and conditions statement which amounts to a large block of text, and other items. When the report shows on screen, the Quote looks just like I intended. However, when I export to Word ...

How to salvage SQL server 2008 query from KILLED/ROLLBACK state?

I have a stored procedure that inserts batches of millions of rows, emerging from a certain query, into an SQL database. It has one parameter selecting the batch; when this parameter is omitted, it will gather a list of batches and recursively call itself, in order to iterate over batches. In (pseudo-)code, it looks something like this: ...

Performing Aggregate Functions on Multi-Million Row Tables

I'm having some serious performance issues with a multi-million row table that I feel I should be able to get results from fairly quick. Here's a run down of what I have, how I'm querying it, and how long it's taking: I'm running SQL Server 2008 Standard, so Partitioning isn't currently an option I'm attempting to aggregate all views f...

SQL Server 2008: Getting duration between user sessions

I have this table UserID SessionID SessionStart SessionEnd ----------------------------------------------- 1 abc1 2010-1-1 2010-1-2 5 def3 2010-1-5 2010-1-9 1 llk0 2010-1-10 2010-1-11 5 spo8 2010-1-13 2010-1-15 1 pie7 2010-1-16 2010-1-...

Float as DateTime

SQL Server 2008 I almost have, I think, what I'm looking to do. I'm just trying to fine tune the result. I have a table that stores timestamps of all transactions that occur on the system. I'm writing a query to give an average transaction time. This is what I have so far: With TransTime AS ( select endtime-starttime AS Totaltime ...

How to get compatibility between C# and SQL2k8 AES Encryption?

I have an AES encryption being made on two columns: one of these columns is stored at a SQL Server 2000 database; the other is stored at a SQL Server 2008 database. As the first column's database (2000) doesn't have native functionality for encryption / decryption, we've decided to do the cryptography logic at application level, with .N...

Adding a custom property to my EF4 Model

Let's say I have two tables in SQL that I want to have an EDMX model generated from (for now, going with automagical generation for everything) using POCO T4 templates. Let's say our two tables are Person (ID, FName, LName) and Comment (ID, PersonID, CommentText, CommentDate) with a one-to-many relation between the two (i.e. you can make...

tsql to know when a database was last shrunk

Hi, In SQL 2000, 2005 and 2008, how can I know when databases were last shrunk on a MS SQL server? I want to do this using TSQL. Regards Manjot ...

row convert to column in sql 2008

I want to convert a series of rows into a series of columns create table #cusphone(cusid int,cusph1 int) insert into #cusphone values(1,48509) insert into #cusphone values(1,48508) insert into #cusphone values(1,48507) insert into #cusphone values(2,48100) so that the output is like this 1 48509 48508 48507 2...

Authentication Problem in Silverlight - Cannot connect to SQL Server

Hi All, At the moment, when I try to register a user using the default Business Template in Silverlight, I am getting an error. Basically I am following a tutorial found on Channel 9 on how to build a business app with Silverlight. "An error has occurred while establishing a connection to the server. (provider: Named Pipes Provider, ...

Joining output data of two T-SQL Stored Procedures from an SP

Right now I have two stored procedures that return data sets, and I'd like to create another stored procedure that executes both stored procedures and returns their combined datasets (to a .Net application). Is this as simple as just running "EXEC" on both of the stored procedures or do I need to add in some logic that combines the two ...

Using TSQL to Unzip a value

How can I unzip a varbinary(max) value in a stored procedure? I'd like to implement or invoke a gunzip algorithm within TSQL code, preferably without enabling the CLR. ...

Is it possible to mirror SQL Server 2008 and SQL Server 2008R2 databases?

Just curious whether it's possible to mirror databases across versions. ...