sql-server-2008

How to get table-like query result on SQL Server 2005/8 ?

I have 3 tables: users (id, name) currency (id, name) accounts (id, user_id, currency_id, amount) And I want to read the data from accounts and present it in table-like view: owner currency1 currency2 currency3 1 0 0 0 2 10 20 30 3 0 5 10 Where owner is ID of accounts.ow...

Storing images on a database

For ages I've been told not to store images on the database, or any big BLOB for that matter. While I can understand why the databases aren't/weren't efficient for that I never understood why they couldn't. If I can put a file somewhere and reference it, why couldn't the database engine do the same. I'm glad Damien Katz mentioned it on a...

TSQL Features in SQL 2008 Vs SQL 2005

What are the advanced Features With SQL2008 over SQL2005 Particularly with TSQL ...

I am using SQL Server 2008, is it ok to define an Index on a DateTime column?

I heard somewhere that declaring an Index on a date column is bad for performance, but I can't find any reference on the internet. Suggestions? ...

SQL problem - high volume trans and PK violation

I'm writing a high volume trading system. We receive messages at around 300-500 per second and these messages then need to be saved to the database as quickly as possible. These messages get deposited on a Message Queue and are then read from there. I've implemented a Competing Consumer pattern, which reads from the queue and allows for...

How can you list all SQL Server tables, their columns, and column data types using Powershell?

I'm trying to do documentation on an SQL server 2008 database. This includes listing all tables, their columns, and the column types. I've been so far as to use "get-childitem | get-member" while browsing the table, the column, and the column's extended properties, and none of them return the data type of the columns. Is there a way to l...

Problem with Indexed View in SQL Server, Error 8646

I was just prototyping a new system for deferring certain operations until out of hours on one of our databases. I've come up with (what I think) a pretty simple schema. I was first prototyping on SQL Server 2005 Express, but have confirmed the same problem on 2008 Developer. The error I'm getting is: Msg 8646, Level 21, State 1, Pro...

Sql Server DATETIME format incorrrect

Hello Folks, I have a field type varchar in sql server. It contains data like "010109" etc. When I try to convert this to DATETIME it returns a value "9 Jan 2001" when the actual value should be "1 Jan 2009". Does anybody have a fix for this? Thanks for your help. ...

Complex insert thru Stored Procedure

Hi, I have 1 table with row data (No Primary Ky). and Another with Primary Key. In row data table, i have multiple records on 3 perameters. And other 10 Field with same value in all the records on these 3 pereameters. Eg. aa bb cc dd ee ff gg hh ii p1 p2 p3 V1 V2 V3 V4 a1 b1 c1 d1 e1 f1 g1 h1 i1 zz 123 03-05-2009 5 2 3...

How to filter SQL Server 2008 Profiler Output for a single database?

SQL Server 2008 Profiler always profiles all databases. I want to restrict profiling or output to a single database. How can that be done most easily? ...

Sql server has detected a non canonical discretionary access control list

After installing SQL Server 2008 Enterprise I received three error messages like this: Setup has detected a non canonical discretionary access control list (DACL) on directory 'c:\Program Files\Microsoft SQL Server\100\COM'. Please verify your security settings and make corrections if needed. What's going on or what I should do? ...

The multi-part identifier could not be bound on SQL Server 2008

I have 2 tables requests (ID, company_id, amount) companies (ID, name) with FK constraint (requests.company_id -> companies.id) requests.company can be NULL I need to get all requests and replace company_id with appropriated company name or left it blank if no company was specified. I have next query: SELECT R.[ID], C.[name] AS [c...

SQL Server Delay Problem

Hello, I have just finished importing an ACCESS db (back-end) to a SQL Server 2008 db. My front-end is still ACCESS 2007 and the back-end is SQL Server 2008. What I've realized is that if I open a form (on a certain record) and then do some calculation which is supposed to fill in some text fields automatically on that form (for that rec...

How to reference System.Xml.Linq in SQL Server 2008 CLR Object?

I want to create a CLR Stored Procedure for SQL Server 2008 that references the System.Xml.Linq assembly. According to the documentation (http://msdn.microsoft.com/en-us/library/ms403279.aspx) this assembly is safe for use in SQL Server 2008. However when I attempt to add a reference using Visual Studio 2008 (Team Suite with GDR R2 ins...

Jobs to improve database availablity and performance

can anyone suggest Jobs that will improve database availablity and performance in sql server 2008? ...

How to extract data from a PDF?

Hi, My company receives data from an external company via Excel. We export this into SQL Server to run reports on the data. They are now changing to PDF format, is there a way to reliably port the data from the PDF and insert it into our SQL Server 2008 database? Would this require writing an app or is there an automated way of doing...

SQL Server Management Studio Quirks - Allowing things it shouldn't and then screaming at you for it

Edit: When I say "SQL Server", I'm really talking about the Management Studio. Sorry if that was confusing. Oh I hate when things like this happen. I was working with SQL Server yesterday and trying out the PIVOT command to try to figure out how it worked. So I created a new table with four columns, and the first column was going to hav...

SQL 2008 Compression

Hello, I am an intern and was asked to do some research on SQL 2008 data compression. We want to store several parts of outlook emails in a table. The problem is that we want to store the entire email body in a field, but then want to compress it. Using Char() will not store the whole body, but will allow compression... using varchar() w...

Update a Status Column Automatically

I am creating a library management application with a membership form. Types of Membership are: Half yearly Annually Patron(For 15 Minutes) Life Member Now I have designed a table in SQL SERVER 2008 which consists of: MemberId Name Joining Date Expiration Date Status The status consists of either M for Member or E for Expired M...

SQL Server 2008 Management Studio doesn't recognize new Schema

I have created a new Schema in a database called Contexts. Now when I want to write a query, Management Studio doesn't recognize the tables that belong to the new Schema. It says: 'Invalid object name Contexts.ContextLibraries'... Transact-SQL: INSERT INTO [Contexts].[ContextLibraries] (ChannelId, [IsSystem]) VALUES (@ChannelId, 1) W...