sql-server-2008

SSIS package not picking up configuration files correctly

We have recently migrated some 30 DTS packages in SQL Server 2000 to SSIS packages in SQL Server 2008. We have created packages in such a way that all environment related variables and other required information are picked from configuration files for maintenance of packages across different environments like Dev, QA and Prod. After se...

how to retrieve the (OUTPUT) value of a SPROC using linq2Sql

Hello, Let's say I've one model HierarchyData and 2 tables (Organizations and Hierarchies). The Organization table contains info on individual Organization while the Hierarchies table contains only int values (identity of each organization) that represents how thos organizations depend on each other. (i)I need to create a group of org...

SQL Server -> 'SQL_Latin1_General_CP1_CI_AS' Collation -> Varchar Column -> Languages Supported

All, We are using SQL Server 2008 with Collation Setting as 'SQL_Latin1_General_CP1_CI_AS'. We are using Varchar column to store textual data. We know that we cannot store Double Byte data in Varchar column and hence cannot support languages like Japanese and Chinese without converting it to NVarchar. However, will it be safe to say t...

Installation doesn't recognize SQL server 2008 saying Server components not found

Please answer these 2 questions: Our installation is not recognising the SQL server 2008. If we try to create a DB, it's saying "Server components not found". Please tell me what may be the issue and why it's not recognising? But our installation proceeds as client installation (if I point to the same instance with DB already created)...

Query to work out possible destinations on a set of routes using SQL Server 2008

I'm writing an application that models train routes, which are stored in the database table [TrainStop] as follows: TrainServiceId StationCode StopIndex IsEnabled So a given train follows a route and consists of several rows with the StopIndex indicating the order. The problem I am trying to solve is to say which stations a user can ge...

Database task to delete table records periodcally in sql server 2008

I want to add a database task that runs on a 6 hours interval. The task is to delete some records that matches certain condition. What is the best way to achieve this in Sql Server 2008 ? I know I can do this on the app side but I want it on sql server side. ...

SQL select statement filtering

Ok, so I'm trying to select an amount of rows from a column that holds the value 3, but only if there are no rows containing 10 or 4, if there are rows containing 10 or 4 I only want to show those. What would be a good syntax to do that? So far I've been attempting a CASE WHEN statement, but I can't seem to figure it out. Any help woul...

Is it possible to determine by way of T-SQL Query whether a sproc is CLR-based or regular T-SQL-based?

Hey all. I'm integrating a CLR/Assembly-based sproc replacement for an existing sproc that lives within our production database, and I want to write an update script that only drops the old T-SQL-based script and doesn't drop the new one if its already there. Is that possible? ...

Using sql server 2008 and TDE is it possible to create a database backup that is not encrypted?

Is it possible to take a database that is using TDE and create a backup file that is not encrypted? I know that I could create a backup, import into another database (using the key and certificate), turn off TDE and create a backup. I'm wondering if there is a more straight forward approach. ...

How to force username and password entry in C# / VS web app?

I am trying to force user to enter username and password when they run my C#/SQL web application. This was developed in VS 2008 on a 32-bit XP. The current connection string I'm using in my web.config file is: <add name="AdventureWorksConnectionString2" connectionString="Data Source=SIDEKICK;Initial Catalog=AdventureWorks;Persist Secu...

Does normalization really hurt performance in high traffic sites?

I am designing a database and I would like to normalize the database. In one query I will joining about 30-40 tables. Will this hurt the website performance if it ever becomes extremely popular? This will be the main query and it will be getting called 50% of the time. The other queries I will be joining about two tables. I have a choi...

How to prompt for username and password entry in C# / SQL ASP.NET web app?

How do I prompt for username and password in my C#/SQL web application? This was developed in VS 2008 on a 32-bit XP. The current connection string I'm using in my web.config file is: <add name="AdventureWorksConnectionString2" connectionString="Data Source=SIDEKICK;Initial Catalog=AdventureWorks;Persist Security Info=false; " ...

How to access web.config connection string in C#?

I have a 32-bit XP running VS 2008 and I am trying to decrypt my connection string from my web.config file in my C# ASPX file. Even though there are no errors returned, my current connection string doesn't display contents of my selected AdventureWorks stored procedure. I entered it: C:\Program Files\Microsoft Visual Studio 9.0\VC>As...

How can I get a SQL Server 2005 compatible backup from SQL Server 2008 database?

I have a sql server 2008 db, I want to restore its backup to a 2005 version. Is there any way for this work? Note: I can't make a script from my db and run it. ...

SQL orderby / case issue: orderdirection fail

I got a stored procedure that delivers a table of students, and it needs to order by surname, name etc... it also needs to sort ascending, descending, depending on the parameter @orderby... code: ORDER BY CASE WHEN @orderby = 'studentkey' THEN Studentkey END ASC, CASE WHEN @orderby = 'studentkey' and @desc = 1 THEN Studentkey END D...

How to make a stored procedure return the last inserted id

Here I have a stored procedure that inserts a row but how do you make it return the last inserted id without making another query CREATE PROCEDURE [dbo].[spInsertCriteriaItem] @GroupID int AS BEGIN -- SET NOCOUNT ON added to prevent extra result sets from -- interfering with SELECT statements. SET NOCOUNT ON; insert int...

SQL Server Query Question

Running SQL Server 2008, and I am definitely a new SQL user. I have a table that has 4 columns: EmpNum, User, Action, Updatetime A user logs into, and out of a system, it is registered in the database. For example, if user1 logs into the system, then out 5 minutes later, a simple query (select * from update) would look like: EmpNum...

Sorting tree with other column in SQL Server 2008

Hi, I have a table which implements a tree using hierarchyid column Sample data: People \ Girls \1\ Zoey \1\1\ Kate \1\2\ Monica \1\3\ Boys \2\ Mark \2\1\ David \2\2\ This is the order using hierarchyid column as sort column I ...

Add command's paramter for jobs with SqlServer 2008

Hi, Is it possible to add command line parameters for a program in an SQL Server job ? We can add a specific job to execute a command line program in C#, with one parameter. but we have an error when we are specifying a second... Any idea ? Thanks for your help. ...

SQL Express as a main DB

Hi everyone, Does anyone out there use SQL Express 2008 R2 in a production environment? I am looking at hosting a Windows VPS as a server for a client software product I have developed. Clients connect to the server, send their data to a service running on the server, and the service updates the database. I'm trying to keep running c...