sql-server

Should I use 'Integrated Security=True' in a production environment?

Is it a bad practice to use Integrated Security=True on a production server in ASP.NET? ...

restore database user login error

Hi, I'm trying to restore a database (SQL SERVER 2008) from a backup in a different server. The problem I have is with the login, as the user is included in the backup but the login is not. So I try to create a new login in the server but it doesnt seem to work. anyone knows a workaround for this? ...

Data Aggregation in SQL Server 2005

I need a query for SQl server 2005 (SQL server management studio express). I have data stored as 1 minute time frame (1 minute each row), for each table columns are ID, Symbol, DateTime, Open, High, Low, Close, Volume. I need to convert (compress) to every possibile multiple time frame, so let's say 10 minutes, 13, 15, and so on. Provid...

SQL Server alias for a cluster?

Hi, I'm looking for a bit of advice setting up a SQL cluster to be accessed via an alias. At present, say my cluster is called 'SQLCLUSTER' and I want to set up an alias to redirect to it. Ideally, I'd like any attempt to connect to '(local)' on either of the machines in the cluster to redirect to 'SQLCLUSTER'. I'm using SQL server 200...

Why is Windows authentication using wrong username?

We have an ASP site using Windows authentication to connect to a SQLServer database. There are three instances of the web site, a Dev environment (located on my Workstation), an UAT environment and a production environment, which are on separate servers. When I access the Dev site (which uses the same DB as the UAT site) I have no issue...

Is there a reason for a Primary Key column that would never be used?

I have a routine that will be creating individual tables (Sql Server 2008) to store the results of reports generated by my application (Asp.net 3.5). Each report will need its own table, as the columns for the table would vary based on the report settings. A table will contain somewhere between 10-5,000 rows, rarely more than 10,000. Th...

good tool to quickly import some csv data into sql server

Every once in a while I find myself typing a one-off script to import some CSV data into a database, doing some column logic (e.g. turn column3 into uppercase) and/or field mapping (column2 in the csv goes to column 3 in de database, etc). Is there a nice tool which can do this easier? The least amount of features I'd need is: choos...

SQL Server table perf comparison -- temp tables, or table variables? Or something else?

In SQL Server, I'm trying to do a comparative analysis between two different table structures with regard to insert performance given different keys. Does it matter if I use a table variable to do this testing, or should I use a temporary table? Or do I need to go to the trouble of actually creating the tables and indexes? Specificall...

Where Is the Syntax Error in this SQL?

I've got a query that is pretty much the same as many others which are used in the same library... but I did a lot of copy&paste on the SQL to add features to each one which are all similar but slightly different. Just below is the section which gives me the SQL Parser error. It fires at the Set rs = line. dim sql, rs sql = "DECLARE @st...

SQL Server TSQL Debugging - Massive View - Any Tips?

Hi, I've been asked to debug a view that's producing split rows where they should be grouping. In trying to debug, I'm trying testing all of the joined sub tables in isolation. The thing is, there's so many dependancies (11 joins in all), that once you get all of the dependencies required to run the query, you basically have the origina...

SQL Server Maintenance Wizard Backup Plans

I used the SQL Server Maintenance wizard (along with a book) to generate both Full and Differentail backups. The Full backup runs on Monday morning and the Differentials run Tuesday through Saturday. The Full backup runs fine and generates the following email report... Microsoft(R) Server Maintenance Utility (Unicode) Version 10.0.2531 ...

SQL Server varchar(MAX) parameter results in "Parameter object is improperly defined"

I have a field in a table that I want to store a potentially long error string. To this end I selected varchar(MAX) as the data type. I have created a stored procedure that is used to enter that data in the table and for the field "ErrorDescription" I used the following parameter definition. @ErrorDescription as varchar(MAX) The probl...

How to assign the previous row value to next row

Date Starting Ending 10/01/2010 0 100 10/02/2010 100 200 10/03/2010 200 300 10/04/2010 300 0 the table has only one column that is ending and i need the output similar to one shown above and using sqlserver 2005 ...

C# and SQL Server 2008 - script differences between dev and production database?

I have a database that I use for all my development and testing and a second database that serves as my production database. What is the best way to script the differences in tables (structure only) between the two? My dev database might have new columns that my production does not have and I need to get the differences into the producti...

Issues with SQL Replication & sp_vupgrade_replication questions

I've got a database from SQL Server 2005 that I am programmatically attaching to an instance of SQL Server 2008 R2, then re-establishing replication on some tables (via some pre-baked scripts that have worked for a small lifetime) with another server still running SQL Server 2005. Suffice it to say it's just a particularly convoluted bu...

Unable to auto-attach aspnetdb.mdb in VS2010

I am using website application in VS2010. It populated data by reading app.config file from another library application. So I copied the connection string both in library project and in website application's Web.config. But when I run the application it throw error as "unable to auto attach aspnetdb.mdb". I did configure aspnetdb.md...

Receive Service Broker from a CLR stored procedure.

Hi guys! I'm trying to move this T-SQL stored procedure to a CLR procedure, but there's a Service Broker specific command that I don't know how to implement: DECLARE @msgBody XML DECLARE @dlgId uniqueidentifier ;RECEIVE top(1) @msgBody = message_body, @dlgId = conversation_handle FROM dbo.Targ...

SQL Server FOR XML PATH nesting issue

I am trying to convert a query to return as xml in the correct format The query is simply SELECT * FROM [TABLENAME], and yes it has to be * as this is used for a dynamic utility that needs to work on any table. Anyhow, I want the resulting records to be nested two levels deep like this <Root> <RecordParent> <Record> ...

SQLCLR trigger vs Windows service. When is it appropriate to use SQLCLR?

We have a .NET e-commerce application with a SQL Server 2005 back-end. A new order requires certain "post-processing". These tasks include sending emails, creating files, uploading files to an FTP server, and performing CRUD operations against a WCF data service. The code to perform all these tasks is already in place as several .NET cla...

Complex SQL Server Query between more than one database

Hello, I have Scenario and i want to convert it to a query. My Scenario: I have lot of dbs with same structure "Clientxxxx" i want to make loop for all these dbs to get data from one table exists in all these dbs called "EventLog" these event log recorded in this table for clients exists in another db called "Portal" I want to get eve...