sql-server-2008

SSIS MYSQL to SQL Datatype

I'm trying to copy data from MySQL to SQL Server 2008. My SSIS is generating error for time (DBTime) column in MySQL database. (cannot convert dbtime to dbtime2) What datatype can i use in SQL server for time? I tired nvarchar, varchar and also tried data conversion task but i get same error. ...

Use varbinary(max) to store HMTL? SQL Server 2008

Hi All, I am trying to figureout the best solution to store html data in some of my tables and track the history of changes made to that HTML. I read that text, ntext, etc are no longer supported for AFTER Triggers so I was thinking of using the varbinary(max) instead. Has anyone used varbinary to store HTML? I was planning on tracki...

Bulk Insert expected performance

Currently we're doing some bulk loading using IRowsetFastLoad and we're getting about 50,000 rows per second. My gut tells me that's low and given the upper bound of the data sizes (around a billion rows), it would be real nice to get that 50K as big as possible. Does anyone have metrics on what we should expect from IRowsetFastLoad? ...

Entity framework with integer primary key but not auto-int does not pass to database

Here's the table and code public class Person { [Key] public int ID {get;set;} public string Name {get;set;} } var owner = new Person() { ID = 1, Name = "Owner" }; db.People.Add(Person); db.SaveChanges(); The SaveChanges method does not add ID to the sql so I end up with the following sql query exec sp_executesql N'insert [d...

Migration strategies for SQL 2000 to SQL 2008

I've perused the threads here on migration from SQL 2000 to SQL 2008 but haven't really run into my question, so here we go with another one. I'm building a strategy to move specific SQL 2000 databases to a new SQL 2008 R2 instance. My question comes with regards to the best method for transferring the schema and data. One way I know ...

What fields types do you suggest for this use case in my database?

I have to have a table that saves information about a Course in my university. I need to save the name of the course, the month it's going to be open, and also the time. What built in Microsoft SQL server datatypes should I use? I'll be using Linq2SQL as my ORM. ...

Empty space at the end of SQL Server query results

I just installed Microsoft SQL Server 2008 R2 to test with LINQ to SQL. I have a table with one column of type nchar(20) and two rows: '123' and 'Test'. If I query all the rows from that table and wrap each value with "'" I get the following: '123 _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ ' ( _ is a space) 'Test _ _ _ _ _ _ _ _ _ _ _ _ _ _ _...

How can multiple Stored Procedures update same row at same time?

I am using SSIS 2008 to execute multiple stored procedures in parallel in control flow. Each SP is supposed to ultimately update 1 row in a table. The point to note is that each SP has a defined responsibility to update specific columns only. It is guaranteed that the different SPs will not update each other's columns. So the columns t...

Store XML in XML type field or using FILESTREAM

Hi All, I am trying to figure out what would be the best method for storing xml documents in the db...if we should use an XML type field or if we should use the newly introduced FILESTREAM? We would have a need to shred those documents for queries and possibly use the FULL TEXT SEARCH to allow for user defined searches on those document...

SQL 2008: returning data rows as JSON?

I think this question is like clay pidgeon shooting.. "pull... bang!" .. shot down.. but nevertheless, it's worth asking I believe. Lots of JS frameworks etc use JSON these days, and for good reason I know. The classic question is "where to transform the data to JSON". I understand that at some point in the pipeline, you have to conver...

Designing a database

Hi All, I am currently trying to design a DB for a new project I am working on. My question stems around Normalizing and Denormalizing....what I am trying to figure out is should you always normalize to the fullest extent? The data will be information that the users will be revising very very rarely and will most often be interacting w...

Select latest record with some more conditions

ID Level Effective Date ExpirationDate 000012-12 2 12/01/2005 NULL 000012-12 1 12/01/2005 NULL 000012-12 2 12/01/2005 01/01/2009 000012-A12 2 10/01/1994 11/30/2005 000012-A12 2 01/01/1999 11/30/2005 000012-A12 2 09/01/2001 11/30/2005 000012-A12 1 12/01/2005 12/31/2007 Only most current Records wil...

Implementing (Date - Time Delta) in SQL Server 2008

I want to be able to send reminders for appointments. Given the tables: - Appointment ID (PK) Start - Reminder AppointmentID (FK) MinutesBeforeAppointmentToSendReminder -- only need minute resolution I would like to select reminder times: select ..., DateAdd(minutes, -Reminder.MinutesBeforeAppointmentToSendReminder, Appoint...

Sql Jobs problem migrating to Rackspace cloud site

I need to shift my production database (SQL Server 2008) to Rackspace cloud site. how to setup and execute my sql jobs on database server. ...

SQL Server 2008 certificate permissions

Hi Following advice to my previous post (thanks fellas, it works a treat), I've implemented a certificate in the master db with VIEW ANY DEFINITION permissions and used this to sign my stored procs so they can access Information_schema. However, my stored procs also make use of dynamic sql. Is it possible to create a certificate, gran...

Add Primary Key to a table with existing clustered index

I have to work with a database to do reporting The DB is quite big : 416 055 104 rows Each row is very light though, just booleans and int ids. Each row is identify by 3 columns, but at my surprise, there is no Primary Key on it. Only a Clustered Index with a unique constraint. So Knowing that, I have 2 question. Could there be ANY g...

NCHAR(1) vs BIT

I'm working under refactoring of database (SQL Server 2008) scheme and gather arguments to change NCHAR(1) columns (which keep Y|N values) to BIT. Everybody understand this is necessary and don't know why does it take place but this change affects production database so weighty arguments are required. Table keeps address catalog (up to 1...

Length of LOB data (78862) to be replicated exceeds configured maximum 65536

Here is a related question. Why do I get this error even when I have not installed SQL Server replication ? The strangest thing is, when I run the fix sp_configure 'max text repl size', 2147483647 Go RECONFIGURE GO it works and I no longer get this error ...

Simple Way to View SQL Query (ies) Generated by SSRS Reports?

Is there a simple way to view the SQL Queries actually generated by SSRS other than running profile traces to capture them? Is there some way from within the BIDS editor to see this? ...

Use multiple words in FullText Search input string

I have basic stored procedure that performs a full text search against 3 columns in a table by passing in a @Keyword parameter. It works fine with one word but falls over when I try pass in more than one word. I'm not sure why. The error says: Syntax error near 'search item' in the full-text search condition 'this is a search item' SEL...