sql-server

How to control what users can decrypt SQL Server Symmetric Key Encryption

I am looking into encrypting some sensitive data in SQL Server, such as bank account numbers and social security numbers in order to comply with new state laws. I am using SQL Server 2008 as my database with .NET code. I have used .NET to encrypt passwords, but for this I'm thinking of using Microsoft's built in encryption by just encryp...

Why would thousands of failed SQL Server login attempts cause an application to break?

Last night we had 45,000 failed attempts to access an SQK Server database on a high profile site, which seems to correlate with portions of the application ceasing to work last night. However, when we pushed the main 3 DLLs live this morning, the issue was immediately corrected. Why would failed attempts to login to the database cause ...

Why use JOIN rather than inner queries

I find myself unwilling to push to using JOIN when I can easily solve the same problem by using an inner query: e.g. SELECT COLUMN1, ( SELECT COLUMN1 FROM TABLE2 WHERE TABLE2.ID = TABLE1.TABLE2ID ) AS COLUMN2 FROM TABLE1; My question is, is this a bad programming practice? I find it easier to read and maintain as opposed to a join. ...

SQL Server Logical Query Processing - how does it manage the huge datasets?

I'm doing some reading on SQL Server performance: http://www.amazon.com/Inside-Microsoft-SQL-Server-2005/dp/0735623139/ref=sr_1_6?ie=UTF8&s=books&qid=1267032068&sr=8-6 One of the surprising things I came across was how it processes the "FROM" phase in its Logical Processing. From what I understand, SQL Server will do the f...

How do I retrieve external data from MS SQL from a Wordpress Blog?

In Wordpress, how would I pull data from an external Microsoft SQL database to display as a read only table? To be clear, this is not a question on how to convert Wordpress over to MS SQL, but rather how to pull data for a specific widget from a source outside the primary Wordpress DB. The data I need to pull from happens to be in a MS ...

SQL: Select from many-many through, joined on conditions in through table

Can't get my head around this... I have 3 tables like this: Computers --------- Id Name ComputerLogins -------------- Computer_Id User_Id NumberOfLogins Users ----- Id Name Computers "have and belong to many" Users "through" ComputerLogins. Sample data: Computers: Id Name 1 "Al...

Retaining NULLs in numerical columns using SSIS Import/Export Wizard?

I am having a problem uploading data from tab-delimited flat files (TSV files) into SQL Server 2005 using the SSIS Data Import wizard. I did not experience this problem using the equivalent procedure in SQL Server 2000, and I have checked that the internal structure of the files I am trying to import is unchanged since well before the SQ...

SQL select row into a string variable without knowing columns

Hello, I am new to writing SQL and would greatly appreciate help on this problem. :) I am trying to select an entire row into a string, preferably separated by a space or a comma. I would like to accomplish this in a generic way, without having to know specifics about the columns in the tables. What I would love to do is this: DECLAR...

SQL Server DDL script to append (or drop) the same set of columns for every table in a database?

How would one write a sql server DDL script that can: For each table in database: add column CreatedBy add column CreateDate add column UpdatedBy add column UpdatedDate Also, if the particular column already exists on the table, just skip that column. Also, the reverse of it, for each table, drop those 4 columns. ...

Opening SQL command from SQL Server 2008?

I cannot find where the sqlcmd is? i just want the prompt. please help! ...

Multi-Application Server Environment and Memcached Security

We are looking to integrate Memcached into our infrastructure, but have a security concern before we do. We run several platforms including ASP.NET and ColdFusion and have many app developers working many little applications across the different platforms. The concern is this: App A places item "dog" into cache. App B reads item "dog" ...

How do I get SQL Server auto-complete working in NetBeans?

I'm using NetBeans with the jTDS JDBC driver connecting to a Microsoft SQL Server. However, I've been unable to get the SQL auto-complete functionality to work. Any ideas how to enable this? ...

Reaching child records in a SQL Server table

Out of my lack of SQL Server experience and taking into account that this task is a usual one for Line of Business applications, I'd like to ask, maybe there is a standard, common way of doing the following database operation: Assume we have two tables, connected with each other by one-to-many relationship, for example SalesOderHeader a...

T-SQL IsNumeric() and Linq-to-SQL

I need to find the highest value from the database that satisfies a certain formatting convention. Specifically, I would like to fund the highest value that looks like EU999999 ('9' being any digit) select max(col) will return something like 'EUZ...' for instance that I want to exclude. The following query does the trick, but I can...

Output not displaying - SQL Server

I have a print statement in a while loop of a stored procedure. The procedure updates around 20,000 records. The print statement should print out the primary key of each record but it does not display in the output window even though the procedure executes entirely and updates all the records. Is there some limit to the amount of data...

Quality Testing Data

Does anyone have recommendations for testing data quality. Imagine you have staged data in one format and executed a process to transfer it to a more relationship normalized format in another database. I would like to create a bunch of tests that could be executed to verify data quality. Does anyone have recommendations as far as tool...

Is anyone successfully using django jython with SQL Server 2005?

I'm attempting to execute my Django 1.1 app, which accesses a SQL Server 2005 database, inside a Tomcat servlet container. I'm using Django-Jython 1.1.1 and Jython 2.5.1 to do this. In settings.py, I set DATABASE_ENGINE='doj.backends.zxjdbc.mssql2k' When I try to get the war file to deploy to Tomcat with: jython manage.py war I...

force output param to not be tinyint?

I just inherited a stored procedure as part of a system for inserting a new user. At the top, @user_id is declared as INT OUTPUT and at the bottom SET @user_id = @@IDENTITY, which always returns zero for some reason. If I do: select @@IDENTITY ...I get something around '1872040' If I do: SET @user_id = 187300 ...I get: Erro...

Infopath - changing sql servers

I have an InfoPath form which has sort of a master-detail pattern, with two tables in the underlying main datasource. I am trying to migrate this to a new SQL Server - same database, just moved from a SQL2005 machine to a SQL2008 machine. If I change the servername, it also wants me to change the database and tables. If I select the s...

Using comparison operators in SELECT clause of T-SQL query

How to select a result of comparison operator as a field with type BIT? How it does work in C#: bool isGreater = FieldA > FieldB; How it doesn't work in T-SQL: SELECT (FieldA > FieldB) AS BIT FROM t How to write such task properly? ...