sql-server-2008

How can I execute a trigger once a certain threshold has been reached?

I have a web app that logs invalid login attempts to a database table. Is there a way to create a trigger on the table that only runs after a certain number of records have been created in the last hours or so, short of something like if count(*) > 100? The end goal is to send an email if there are an abnormal number of failed login at...

SL4 WCF RIA Query Issue: "Completed" happening before it's really completed?

I have a strange little issue with a WCF RIA service I'm using in a SL4 application. Here is the code for a button click handler I've got: private void btnTest_Click(object sender, RoutedEventArgs e) { LanguageContext context = new LanguageContext(); LoadOperation<Language> op = context.Load(context.GetLanguagesQ...

SQL Server Clustering limit?

Can you do SQL Server Clustering of more than 2 servers? Master can have more than 1 slave? What is the limit? ...

Restoring a Backup with SQL Server

Hello, I have a SQL Server database that I am trying to restore. My source database was on a SQL Server 2005 installation. My new server is a SQL Server 2008 machine. I have backed-up the database on the SQL Server 2005 installation. I am trying to restore it onto the SQL Server 2008 installation. When I try to restore the backed-up da...

Changing local clock affects remote SQL Server database functionality

Hi all, I'm having an issue with some SQL Server 2008 queries and I think I got it down to differences between the server and the local application. Here's a basic description of my scenario: I'm using a local application that performs insert statements on a remote database. Everything works fine until I change the clock on the local m...

Efficiently pulling thousands of records with SQL Server?

This is kind of a part 2 to this question: http://stackoverflow.com/questions/3319842/select-rows-and-update-same-rows-for-locking I have a table in my database that hold millions of records. I have created a stored procedure to pull X amount of records and mark them as being locked so when my application calls the next set of X amount ...

How to migrate database from Oracle to SQL Server?

I have a database on Oracle 9i. Now I want to work on SQL Server 2008. I want to migrate the Oracle database to SQL Server, but how do I do that? Give me some syntax? Thanks for the help. ...

Running SQL Server full-text search statements from Entity Framwork

Essentially, it's a rehash of this question for Entity Framework 4. http://stackoverflow.com/questions/534356/how-do-you-do-full-text-search-fts-with-linq-to-ado-net-entity-framework At this time we are using SqlDataReader where we submit a query with ... WHERE FREETEXT(description, "value). However, as we are moving to EF4, I would pre...

Question on AdventureWorks DB...What is the point of rowguid in a lot of the tables?

So I think I already know the answer to this question... Running AdventureWorks2008 (latest version) on mssql server 2008. I am thinking that the rowguid column in a lot of the tables is to ensure that there is a primary key. I am probably dead wrong as the column appears to be a constraint. Correct me if I am wrong and also please cor...

Getting Rid of DBO? SQL 2008

Just wondered if there was a secret to do something like Database.Security.Users like AdventureWorks DB is setup. Seems no matter what I do to try to setup "Security.Users", I always get the dbo in front of it and have a hell of a time in C# accessing the info. Am I doing something wrong? ...

ADO.NET Insert Min Value into SQL Server 2008 Date column crashes

Hi, I'm trying to do the following: using (var tx = sqlConnection.BeginTransaction()) { var command = sqlConnection.CreateCommand(); command.Transaction = tx; command.CommandText = "INSERT INTO TryDate([MyDate]) VALUES(@p0)"; var dateParam = command.CreateParameter(); dateParam.ParameterName = "@p0"; dateParam.DbType = DbType.Dat...

Database Design: Is there a great program to prototype in and then 'export'?

I have been playing around with Visual Studio 2010 over the past few days working with their SQL Template. I have to say...BOOOOOOOO...not working. Now I have had more fun with xsd's in Visual Studio's C#. I expected database design to be that easy or better but no such luck. Are there any applications out there that you would recommend...

SQL Server Express 2008 originally installed and then upgraded SQL Server Management 2008 - but no profiler

Originally I had two instances of SQL Server Express 2008 installed on my machine, IT then removed these so that they could upgrade me to SQL Server Management 2008 (with the aim that I would have profiler). My two original instances are there, however under tools there is no profiler. Should the IT guy installed a third instance so that...

SQL Server SSMS: how to get row numbers for a batch

In SSMS, how can I get SSMS to show row numbers for a batch? I can get row numbers for a query window, but that does not help when an error occurs in batch statement. This feature would help me a lot to find errors from my code. ...

help with SQL query?

Hi Guys, I am not sure if I should do this in the code or do it in the query, but I will ask it here as I am interested in a sql solution for myself. Say if I have the following table, and I need to get all the rows whose ParentSID is 1. But if any of these rows return have Null as FID then I also need to go fetch all rows whose Parent...

How to snapshot a SQL Server Database without taking it offline

We occasionally want to copy our production database with data and have it populate a corresponding database in our test environment so that we can reproduce production problems. We currently wait for a maintenance window and do an Detach/Attach. We're using SQL Server 2008 and both test and production databases are on the same server....

displaying sql data as 1 match

I hope I can explain this clearly: I have two tables with the following structures: TABLE A{id, source, url} TABLE A2{matchid,matchsource,matchurl,country,lang} and I have a join on them: TABLE B{id,source,url,matchid,matchsource,matchurl,country,lang} Table B is a join of A with A2 where for each record in A there are matching rec...

WCF Problem with Windows server 2008

i have a weird problem, i have a wcf hosted in a Console Application now i tried it on 3 pcs all running windows 7 it worked fine, but when i take it to the server (windows server 2008) it doesnt work , now i checked firewall and everythings ,i cant seem to get it to work no matter how hard i tried , im not sure if this is has anything t...

what is difference between Sql server 2008 Developer version and Sql server 2008 expess edition

i want to know about the difference in this two version Sql server 2008 Developer edition Sql server 2008 expess edition ...

How to change the schema for a diagram?

Hi, Diagrams created with Microsoft SQL Server Management Studio have their default schema set to dbo. It seems that there is no way to set another schema when creating a diagram. For tables, alter schema NewSchemaName transfer dbo.TableName moves a specified table to the new schema. But the same command does not work for diagrams. ...