sql-server-2008

Sql Server Object Organisation

OK I'm not sure if this is valid, however I have a bug bear with SQL Server, and that is that I cannot organise objects in to a group of objects. Imagine I'm working on a new section of work in a large database and I perhaps have 15 objects that I will be regularly using. What I want to do is sort of "Favourite" them in to a folder so t...

Which should I install first: Visual Studio 2008 or SQL Server 2008?

Hi, Half a year ago, I installed Visual Studio 2008 and SQL Server 2008. I don't quite remember which I installed first, but since then I am unable to connect to any file-based SQL server databases from the Visual Studio IDE. I think it was related to a bug in Visual Studio, the fact that I had previously installed Visual Studio 2005 on...

Northwind Starters Kit

Is the Northwind Starter Kit from Codeplex a good starting point to learn more about how to best architect an ASP.NET application? Is there something similar for the AdventureWorks database examples? ...

Linq to sql, summing timespan?

I have a time field in a mssql 2008 database that I want to do something to the effect of: Timespent = x.sum(x => x.AmountOfTime); Where AmountOfTime is a time MSSQL field. Sum seems to only work on decimals, how can I add these columns? ...

Is there a way to import SQL script into MDF database in Visual Studio?

I created a "Service-Based Database" (.MDF) in Visual Studio and now want to import a SQL script into it, but cannot find any way to do this: I can right-click on the .mdf file and choose "New Query" but there is no place to copy in query text as in Management Studio Does the Visual Studio 2008 Database Explorer have a way to enter o...

How do I remove an Identity completely

I'm currently putting together some changes in our data model which include changing a column (that happens to be part of the primary key) so that it is no longer an identity. Is there a way to do this short of actually removing and recreating the entire column or table? The autogenerated code from SSMS does just that but I was wondering...

Passing a list to a TSQL 2008 Stored Procedure

In MSSQL Server 2008 is there a way to construct the flowing as a stored procedure where the ... is passed in as a parameter. And not have to have a "separating" stored procedure or function which splits a csv and returns a table? select * from atable where atable.id in (...) ...

Howto rewrite phone numbers in TSQL?

I have a beginners question in TSQL. We imported Excel Sheets into a SQL Server 2008. Too bad these excel files were not formatted the way they should be. We want a phone number to look like this: '012345678', no leading and trailing whitespace and no whitespace within. Even worse sometimes the number is encoded with a prefix '0123-2349...

Enable SSRS My Reports using Express edition

Is there a way to enable the “My Reports” feature in SQL Server Reporting Services 2008 when I am using SQL Server 2008 Express edition with Advanced Services? As I am using Express edition, I cannot connect SQL Server Management Studio to Reporting Services: - "SQL Server Management Studio Express cannot be used to administer a ...

MS SQL Server 2008 - Confusion in migrating from MySQL re: "select XYZ from TABLE"

So I'm just confused here. I've got to migrate my database from MySQL to MS SQL Server 2008. I've transferred the data via the "MS SQL Data Wizard" app from SQL Maestros. It took the data+structure from my MySQL database "gk" and copied it into a database "gk" on my MS SQL Express instance. But when I connect to the MS SQL instance a...

Cannot access property spatialindextype

I'm using SQL Server 2008, and I go to try and script one of my tables, I get the error "Cannot access property SpatialIndexType This is not available in Sql Server 2005". Trouble is, I'm using 2008. I have no idea what this means. I just want to script the table so I can create it in a dev database without having to add all the column...

How to create a unique constraint just on the date part of a datetime?

I'm writing a very simple blog engine for own use (since every blog engine I encountered is too complex). I want to be able to uniquely identify each post by its URL which is something like /2009/03/05/my-blog-post-slug. To accomplish it in the data tier, I want to create a compound unique constraint on (Date, Slug) where Date is only th...

User-Defined Aggregate in SQL Server 2008 - How to deploy with MaxByteSize = -1?

I read here (and elsewhere) that it's possible, in SQL Server 2008, to build a user-defined aggregate which can return a string longer than 8000 characters. This is exactly what I need. Supposedly, the method is to set maxByteSize to -1 instead of a number btw 1 and 8000; this should allow any size up to 2GB. For some reason, apparent...

Data visualization with Virtual Earth and SQL

Scenario: I have a list of addresses (they have already been converted to lat/long) and the conference that the person attended. What I want: I want to add a circle shape to a Virtual Earth map that covers, let's say, 90% of the attendees to a conference. I will repeat this for each conference. This will show me how much the differe...

Reverse Engineer SQL2008 Database to Diagram

Visio 2007 support reverse engineering a MSSQL Database. However, SQL2008 is not supported (link). Are there other (free?) tools that can do this? thx. ...

How do you change the datatype of a column in MS SQL?

I am trying to change a column from a varchar(50) to a nvarchar(200). What is the SQL command to alter this table? ...

Why does calling full text search in SQL Server 2008 fail when inside transaction scope?

The following code: var foo = Users.Join( tvf_SearchUsers(queryString), u => u.User_Id, s => s.User_Id, (u, s) => u); Selects users that match the query string based on a table valued function (tvf_SearchUsers), which utilises full text search. This code snippet is part o...

Reporting Services - Group Name in Page Header

I have a report with one group (Office Name) which page breaks between each group - so the data for only one Office can appear on a given page. How do I get that Office Name to appear in the page header? I tried creating a hidden textbox in the details section of the report which has the Office Name value and then referencing that i...

SQLXML with Windows 2008 and SQL Server 2008

Hi all, I have an application that uses SQLXML to access data on the database. We have it working on a Windows 2003 server and SQL Server 2005. Now the client wants to install it on Windows 2008 and SQL Server 2008 and we are getting errors like: Microsoft.Data.SqlXml.SqlXmlException: Class not registered ---> System.Runtime.InteropServ...

Active - Active DR Strategy for SQL Sever 2005

We are trying to come up with an Active - Active DR strategy for our 6 TB data warehouse. Our datawarehouse has 40 DBs and everything has to be replicated on a real time bases. Site 1 : Needs to handle all the ETL Site 2 : Will handle all the reporting queries. Database Mirroring (Cannot afford to drop and create snapshots as we cann...