sql-server

Encrypting Windows Authentication connection strings

I am accessing an SQL Server database using Windows Authentication Do I need to encrypt the connection string in the web.config? Does the name of the connection string (or database) matter in terms of security? (viz: ApplicationServices? ...

Editing table/adding records manually to sql server 2005

Is there any option in sql server 2005 management studio to change columns in a table by hand and by the sql commands alter table or insert into. If yes, then could someone please show how or link to some instructions? ...

C# - SQL Server - ? parameters and Oledb

I am writing a small framework in C# for importing data to SQL Server. I have noticed that if you try to use the ? placeholder for parameters, they do not work if you use the System.Data.SqlClient namespace. However, if you use the System.Data.OleDb namespace for working with the database, they work just fine. (you just have to add Pr...

The INSERT statement conflicted with the FOREIGN KEY constraint

Error: System.Data.SqlClient.SqlException: The INSERT statement conflicted with the FOREIGN KEY constraint "FK__Item__order__3AE27131". The conflict occurred in database "pmall", table "dbo.ItemSaved", column 'id'. Here's my table: ItemSavedUnits id ItemID (is set in this table a FK to Item.id) ...etc. Here's my insert stat...

What gets disposed when SqlCommand.Dispose is called?

In theory since SqlCommand implements IDisposable a SqlCommand object should always be disposed. I personally wrap a using statement around them. However I see lots of code that never disposes of SqlCommand objects without any apparent problems. I understand that finalizers will ultimately be called by garbage collection but since that ...

Storing a SHA512 Password Hash in Database

In my ASP.NET web app I'm hashing my user passwords with SHA512. Despite much SO'ing and Googling I'm unclear how I should be storing them in the database (SQL2005) - the code below shows the basics of how I'm creating the hash as a string and I'm currently inserting it into the database into a Char(88) column as that seems to be the le...

Data Correlation in large Databases

We're trying to identify the locations of certain information stored across our enterprise in order to bring it into compliance with our data policies. On the file end, we're using Nessus to search through differing files, but I'm wondering about on the database end. Using Nessus would seem largely pointless because it would output the...

How to merge XML in T-SQL?

It doesn't seem that any amount of reading the docs will help me. Consider the simplified example: declare @table1 table ( id int, parent xml ) insert @table1 values( 1, '<Root></Root>' ) declare @table2 table ( id int, guts xml ) insert @table2 values( 1, '<Guts>hi mom!</Guts>' ) select t1.parent.query('') from @table1 t1 inner join ...

Strategies for testing against a live system.

Let me describe the scenario: Our VB.NET web application talks to a third party data provider via webservices. It also saves data in a HUGE SQLServer database which has extensive business logic implemented in stored procs and triggers. The webservice provider also employs convoluted business logic which is quite dynamic. The dilemma ...

SQL Server 2008 extremely slow using FTS on joined tables

I have two tables Product (id int, brandid int,Name nvarchar(1000)) 2+ million rows Brand (id int,name nvarchar(1000)) 20k rows FullText index is enabled on both table's name field. If I do a search such as SELECT count(*) FROM Product p join Brand b on p.BrandID = b.ID WHERE contains(b.name,'calvin') Runs super fast...

Identify individual sql user in SQL profiler And activity monitor

We're using SQL 2005 and want to identify individual users so we can trace their SQL for performance purposes, but we're finding it hard to unique identify who is who. We're using SQL 2005 with connection pooling so every user has the same user in the Activity Monitor. Their NT user name doesn't appear to be set - maybe because we're us...

sql query problem, manipulate data.

I have stored proc that will tell us if there is any new checks to be printed. Now I have to manipulate the data in database table in order to get at least one check to be printed. I didn't write this query. I tried but I didn't get at least one check to be printed. Can anyone help me. HERE IS THE STORED PROC CREATE PROCEDURE [proc_1250...

How to see the connection string used to connect to SQL Server

Is there a way to see what connection string was used to connect to SQL Server? Or rather what string was used in a failed login attempt. Many times I deal with complex systems in which I see failures caused by some service failing to log in to SQL. I am guessing the connection string might be wrong, but since I can't see what it was I ...

displaying multiple records by using resultset

how to display multiple records from database having the same field value by using result set statement ...

How to do a case sensitive search in SQL Where clause (I'm using MS SQL Server) ?

I want to do a case sensitive search in my SQL query. But by default, MS SQL server does not consider the case of the strings. Any idea on how to do a case sensitive search in SQL query? ...

Login_per_seconds is too high in sql server

We are using SQL Server 2000 for our online application. Recently we are getting one problem like login_per_seconds is too high . Its turned to the critical error and need to be figure it out. Can any one please help me to get of this critical problm . . . ...

fastest way to query database in java

I have a MSSQL Database, and I have a stored procedure for any possible query, most of them just return a row of data with 3 columns or just execute an INSERT How in java to connect to the DB and execute a stored procedure, and retrieve some data ? ...

Ordering query result by list of values

I'm working on a sql query that is passed a list of values as a parameter, like select * from ProductGroups where GroupID in (24,12,7,14,65) This list is constructed of relations used througout the database, and must be kept in this order. I would like to order the results by this list. I only need the first result, but it could be ...

How Decimal places are converted using FLOAT in SQL Server 2000/2005/2008

Hi, in this SO question the OP wanted to drop the 0's in the decimal places for his results. Now the example I gave (below) to get around this was to CAST with DECIMAL, then CAST with FLOAT. e.g. SELECT CAST(0.55 AS FLOAT) Using the example above and running it in SQL Server 2005/2008 would seem to bring up the correct result of 0.5...

A question about desining a faster algorithm in T-SQL for a CASE that I will be telling.

Hello people. Here is the CASE I have an sql table consisting of just one data column, consisting of some group names. Here how the table looks: OPEN SYSTEMS SUB GR OPEN SYSTEMS SUB GR (GM/BTIB(1111)/BTITDBL(2222)/BTVY(4444)/ACSVTYSAG INFRASTRUCTURE SOFT SUB GR INFRASTRUCTURE SOFT SUB GR (GM/BTIB(1111)/BTUGBL(3333)/BTUGBL(3333)/BTAUS...