sql

Handling empty values with ADO.NET and AddWithValue()

I have a control that, upon postback, saves form results back to the database. It populates the values to be saved by iterating through the querystring. So, for the following SQL statement (vastly simplified for the sake of discussion)... UPDATE MyTable SET MyVal1 = @val1, MyVal2 = @val2 WHERE @id = @id ...it would cycle through t...

How to write an SQL query to find out which logins have been granted which rights in Sql Server 2005?

I'm responsible for some test database servers. Historically, too many other poeple have access to them. They run on SQL Server 2005. I've been writing queries and wrapping them in scripts so I can run a regular audit of rights. Finding out which users had Administrator rights on the server itself was fine, as was finding out who had...

What are the first tasks for implementing Unit Testing in Brownfield Applications?

Do you refactor your SQL first? Your architecture? or your code base? Do you change languages? Do you throw everything away and start from scratch? [Not refactoring] ...

Dynamic Database Schema

What is a recommended architecture for providing storage for a dynamic logical database schema? To clarify: Where a system is required to provide storage for a model whose schema may be extended or altered by its users once in production, what are some good technologies, database models or storage engines that will allow this? A few p...

Backup/Restore database for oracle 10g testing using sqlplus or rman

Using Oracle 10g with our testing server what is the most efficient/easy way to backup and restore a database to a static point, assuming that you always want to go back to the given point once a backup has been created. A sample use case would be the following install and configure all software Modify data to the base testing point t...

Looking for a very basic introduction to SQL

I'm looking for a webpage or some other resource that provides a very basic introduction to SQL queries. I'm teaching a class on Geographic Information Systems and I'd like to go into a bit more depth on SQL than the textbook does, but I still want a written resource that I can point the students to. Most of the class are not computer ...

What is the best way to implement soft deletion?

Working on a project at the moment and we have to implement soft deletion for the majority of users (user roles). We decided to add an "is_deleted='0'" field on each table in the database and set it to '1' if particular user roles hit a delete button on a specific record. For future maintenance now, each SELECT query will need to ensure...

Implement symmetric difference in SQL Server?

Here's a problem I've been trying to solve at work. I'm not a database expert, so that perhaps this is a bit sophomoric. All apologies. I have a given database D, which has been duplicated on another machine (in a perhaps dubious manner), resulting in database D'. It is my task to check that database D and D' are in fact exactly iden...

Error 0x8007F303 occurs during printing of reports from MOSS using SRS viewer web part

When attempting to print using the SSRS Viewer Web Part in SharePoint I get the following error. An error occured during printing. (0x8007F303) The settings we are using in this box (production) are exactly the same as the settings in testing where this works perfectly fine. Anyone have any good ideas or faced this before? ...

Terminate MySQL connections on shared host?

I'm using MediaTemple's Grid Server (shared/grid hosting) to run some MySQL/PHP sites I'm writing and noticed that I wasn't closing one of my MySQL connections, which caused my site to error out, "Too Many Connections". I can't log in anywhere to close the connections manually. Is that any way to close open connections using a script ...

What do you use to write and edit stored procedures in Oracle?

There are many options for editing and writing Stored Procedures in Oracle; what is the best tool for you and why? (one tool per answer.) ...

Cross-server SQL

I want to port data from one server's database to another server's database. The databases are both on a different mssql 2005 server. Replication is probably not an option since the destination database is generated from scratch on a [time interval] basis. Preferebly I would do something like insert * from db1/table1 into db2/table2 wh...

SQL MAX of multiple columns?

How do you return 1 value per row of the max of several columns: TableName [Number, Date1, Date1, Date3, Cost] I need to return something like this: [Number, Most Recent Date, Cost] Query? ...

SQL: Counting unique votes with a rolling votes-per-hour limit

Given a table of votes (users vote for a choice, and must supply an email address): votes -- id: int choice: int timestamp: timestamp ip: varchar email: varchar What's the best way to count "unique" votes (a user being a unique combination of email + ip) given the constraint they may only vote twice per hour? It's possible to count t...

Is there some way to inject SQL even if the ' character is deleted?

If from an SQL query I remove all the ' characters, is there some other way to do an SQL injection attack on the database? How can it be done? Can anyone give me examples? ...

How can i search a non case sensitive word with Sql Server XQuery?

I'm using an Xml field in my Sql Server database table. I'm trying to search a word using the XQuery contains method but it seems to search only in case sensitive mode. The lower method isn't implemented on Sql Server XQuery implementation also. ¿Is there a simple solution to this problem? ...

How to implement a Digg-like algorithm?

Hi, How to implement a website with a recommendation system similar to stackoverflow/digg/reddit? I.e., users submit content and the website needs to calculate some sort of "hotness" according to how popular the item is. The flow is as follows: Users submit content Other users view and vote on the content (assume 90% of the users only...

ORA-00933: SQL command not properly ended

I'm using OLEDB provider for ADO.Net connecting to an Oracle database. In my loop, I am doing an insert: insert into ps_tl_compleave_tbl values('2626899', 0, TO_DATE('01/01/2002', 'MM/DD/YYYY'), 'LTKN', 'LTKN', '52', TO_DATE('01/01/2002', 'MM/DD/YYYY'), 16.000000, 24.000)insert into ps_tl_compleave_tbl values('4327142', 0, TO_DATE('03...

Penetration testing tools

We have 100s of websites which were developed in asp, .net and java... and we are paying lot of money for an external agency to do a penetration testing for our sites to check for security loop holes. Are there any (good) software (paid or free) to do this? or.. are there any tehnical articles which can help me develop this tool. ...

How would you create a database in microsoft access that is searchable only by certain fields?

How would you create a database in Microsoft Access that is searchable only by certain fields and controlled by only a few (necessary) text boxes and check boxes on a form so it is easy to use - no difficult queries? Example: You have several text boxes and several corresponding check boxes on a form, and when the check box next to the...