sql-server-2008

Change Notification with Sql Server 2008

I have an application that consists of a database and several services. One of these services adds information to the database (triggered by a user). Another service periodically queries the databases for changes and uses the new data as input for processing. Until now I used a configurable timer that queries the database every 30 sec...

Password Encryption / Database Layer AES or App Layer AES

I need to encrypt / decrypt passwords for a new application. The spec requires me to use AES; can anyone suggest a good reason to either Do all my encryption in the database layer using CLR functions or Doing it at the .Net app layer ? a mixture of db and server Am going to be validation passwords; the app is n-tiered using Telerik O...

Can you recommend a Sql Server 2008 book for developers that only addresses the new features?

I am looking for a book that only addresses the new development features of Sql Server 2008. I had read "A First Look at Sql Server 2005 for Developers" years ago but cannot find an equivalent book. ...

how to create a scheduled process in sql server

In MSSQL Server 2008, how would I go about creating a scheduled process that: Takes the sum of a float column from specific users in a user column and then comparing which is has the greatest sum and storing that number along with the user whom has that value into a separate table on a weekly basis? ...

Transfer data from Sybase 8.0 database to SQL server 2008?

Hi I have a dts package in sql server 2000 that gets data from a Sybase 9.0 database. I am trying to create a new DTS package to setup as a job in SQL server 2008 using the dsn connection file but I cannot get past selecting the dsn file part? Sorry for the vagueness of this question but I basically want to get connected to a Sybase 9...

SQL select from a group

Suppose we have the following table data: ID parent stage submitted 1 1 1 1 2 1 2 1 3 1 3 0 4 1 4 0 5 5 1 1 6 5 2 1 7 5 3 1 8 5 4 1 As you can ...

Running Sql Server stored proc in context of caller

This is making me nuts and I'm sure the answer is SO easy. I have multiple schemas that each have a view named "Task". I want to make a single stored proc that users running in multiple default schemas can execute successfully -- that stored proc does a select on the Task view. So say I have these objects: View: fr.Task (users with d...

MERGE INTO insertion order

I have a statement that looks something like this: MERGE INTO someTable st USING ( SELECT id,field1,field2,etc FROM otherTable ) ot on st.field1=ot.field1 WHEN NOT MATCHED THEN INSERT (field1,field2,etc) VALUES (ot.field1,ot.field2,ot.etc) where otherTable has an autoincrementing id field. I would like the insertion into ...

How would a single script truncate a particular table in every database?

I have a Microsoft SQL Server 2008 with many databases and most of them have a Logs table. I would like to be able to schedule a script to run and truncate the Logs table in every one of these databases (dynamically). I imagine I have to get the name of every user database then truncate the table Logs in the databases that contain a Logs...

SQL Server 2008 Express Edition Connection Problem

...

Comments in SSRS Report Expressions

I'm using some complicated expressions in Reporting Services to control the value, format etc of data in a report (see MSDN). Is it possible to insert code comments into these expressions, and if so, what is the syntax? By code comments I mean something like: // single line comment /* or multi line comment */ ...

SQL 2005 express with 2008 express compatibility

I installed VS 2008 without SQL 2005, then I installed SQL 2008, then I needed 2005 express so I reinstalled VS checking the SQL feature. The installation went OK, however I still cannot open mdf files from VS. I think there is no 2005v instance installed. When I dbl-click an mdf file in VS I get the following message: Connections to SQ...

SQL Server Version Updating Tables

I am part of a software development company looking for a good way to update my SQL Server tables when I put out a new version of the software. I know the answer is to probably use scripts in one form or another. I am considering writing my own .NET program that runs the scripts to make it a bit easier and more user-friendly. I was wond...

How to disable SQL Server Management Studio for a user

Is there a way to prevent users from getting into SQL Server Management Studio so that they can't just edit table rows manually? They still need to access the tables by running my application. ...

Disable Sql 2008 caching?

I have application that makes different queries with different results so the caching in my case is harmful. This means there is no common data that sql may benifit from it to fetch the result from memory directly instead of making hard disk access. ...

SQL Server 2008 T-SQL Join problem

Followed up by a new question, that contains the question as text, not as an image like this one: http://stackoverflow.com/questions/904209/sql-server-2008-t-sql-join-problem-ver-2/904450#904450 (This question is an image. Right click on "I have some table with value". :) The query should automaticly work if a new position record i...

SQL Server 2008 T-SQL Join problem ver 2

I have some table with data Category CategoryID CategoryName 1 Home 2 Contact 3 About Position PositionID PositionName 1 Main menu 2 Left menu 3 Right menu ...(new record can be added later) CategoryPosition CPID CID PID COrder 1 ...

Instead of trigger in SQL Server loses SCOPE_IDENTITY?

I have a table where I created an INSTEAD OF trigger to enforce some business rules. The issue is that when I insert data into this table, SCOPE_IDENTITY() returns a NULL value, rather than the actual inserted identity. Insert + Scope code INSERT INTO [dbo].[Payment]([DateFrom], [DateTo], [CustomerId], [AdminId]) VALUES ('2009-01-20',...

SQL Server query grouped by max value in column

**Update: using the Rank() over partition syntax available in MS SQL Server 2005 does indeed point me in the right direction, it (or maybe I should write "I") is unable to give me the results I need without resorting to enumerating rows in code. For example, if we select TOP (1) of rank, I get only one value, ie., slot 1. If I use MA...

SQL Select Statement For Calculating A Running Average Column

I am trying to have a running average column in the SELECT statement based on a column from the n previous rows in the same SELECT statement. The average I need is based on the n previous rows in the resultset. Let me explain Id Number Average 1 1 NULL 2 3 NULL 3 2 ...