sql

Execute stored procedure named as a string

How can I execute a stored procedure named as a string I tried this: EXEC CAST(@GetDD AS StoredProcedure); ...

User Permission

In my web application we have many users.I want to set permission for each user.In our windows application we used Database to store the Permission(Insert,Modify,delete and View).In web application can anybody tell me about where to store the permission.Somebody told that if we use database it will take so much time?In the case of XML it...

Have mysql re-allocate ids in a continuous range

I have an existing database in mysql. One of my tables has discontinuous ids. I would like to modify the ids of the table so that they go from 1 to num-of-rows. This particular tables does not happen to have incoming references, so the ids can be changed without modifying other tables. The reason I want to do that is that I want to pro...

Case-Else for decimal values in SQL

Hi, I have a table named 'Table1' from which i need to retrieve an 'Amount' as per one condition.If the 'Currency' is some 'Dollar',i want the amount to be displayed in 1 decimal place.if the currency is other than 'Dollar',the amount should in 2 decimal places.I have used the case-else condition for this.But it is not checking the condi...

Android with SQL Server 2008

Does Android supports SQL Servers? If so how to connect to SQL 2008 in my Android Application? ...

What is the best way to select multiple rows by ID in sql?

I need to select multiple records I use SELECT * FROM `table` WHERE `ID` =5623 OR `ID` =5625 OR `ID` =5628 OR `ID` =5621 this query run 4 times in every second whit php is there a better and faster way for this ? ...

Create a New user ORACLE with full access to an specific SCHEMA

How can create a New user in ORACLE with full access (alter, delete, select, inset, debug, etc) to an only one specific SCHEMA. ...

Sqlite: How to insert variable into string in prepared statement

I'm using a Java wrapper for accessing Sqlite but I assume this is a general Sqlite question. String stmt = "SELECT foo FROM bah WHERE foo='%/?/%'; PreparedStatement a = myConn.prepareStatement(stmt); a.setString(1, "hello"); a.executeQuery(); ... throws an exception - it doesn't like the ? being inside quotes. Everything is fine if ...

How can this SQL query code be broken/exploited by user input?

Possible Duplicate: Can I protect against SQL Injection by escaping single-quote and surrounding user input with single-quotes? We have a legacy app that doesn't do queries using positional parameters, and there's SQL everywhere. It was decided (before I started here) that since user input can contain apostrophes, every string...

Finding a single record in a table step-by-step by different requests

There is a table in a databse, let's call this table Document. This table has fields: MajorVersionNumber MinorVersionNumber ReleaseDate There are rules to determine the order of versions and their expiration dates. I'll give the rule of finding expiration date of a version in C# 3 because it looks more easy to read then in English. ...

SQL Management Studio 2008 - Server name on Query Editor tabs...where did they go???

I recently upgraded to SQL Management Studio 2008 (full not express, if it matters). In 2005, when I was in the Query Editor, each tab (with an unsaved query) would have the servername-instance-query name or something like that, but all I cared about was seeing the server name there so I knew which server I was running my query on. In ...

Where are Cartesian Joins used in real life?

Where are Cartesian Joins used in real life? Can some one please give examples of such a Join in any SQL database. ...

Should I rollback failed SELECT statements or commit successful ones?

Out of habit I've been using try/catch blocks in my application code for all SQL queries, with a rollback at the beginning of the catch block. I've also been committing those which are successful. Is this necessary for SELECTs? Does it free up something on the database side? The select statements aren't altering any data so it seems ...

Recommended ORACLE Role for user

Wich role is recommended for an ORACLE user used internally by an desktop or web application? this application makes querys, updates and inserts over only one schema. Exist a default o recommended role for this task? ...

how can I update rows at random?

I'd like to go through a table and randomly wipe out some of the data. I'm doing some data randomizing, turning real first names into fake ones etc. Well one of the tables involved has a column that is null about 40% of the time. My name randomizer app could do a coin toss somewhere in it when it assigns new first names. But I'd prefer t...

how to do order by on a to_char column

I have a following oracle query: SELECT a.USER_ID, c.first_name, c.last_name, TO_CHAR( b.logon_date, 'MM/DD/YYYY HH:MI:SS am') logon_date, NVL(TO_CHAR( b.logoff_date, 'MM/DD/YYYY HH:MI:SS am'), '') logoff_date, a.session_id FROM table a, table b, table...

how to do union of the following two queries

Am trying to do the union of the results of two queries. But I'm getting the following error: Error at Command Line:9 Column:81 Error report: SQL Error: ORA-00907: missing right parenthesis 00907. 00000 - "missing right parenthesis" SELECT application_id, clicks, datee, client_id FROM( (select APPL_CD AS application_id, count...

Stored procedure performs terribly - increase timeout or fix the problem

I've inherited a front end written by a third-party. That front end interacts with Oracle through procedures written by a different third-party. The stored procedure in question requires 2 minutes and 36 seconds to return search results when it is manually executed. I can't see the procedure and that team has suggested that I increase...

How to apply a SUM operation without grouping the results in SQL?

I have a table like this one: +----+---------+----------+ | id | group | value | +----+---------+----------+ | 1 | GROUP A | 0.641028 | | 2 | GROUP B | 0.946927 | | 3 | GROUP A | 0.811552 | | 4 | GROUP C | 0.216978 | | 5 | GROUP A | 0.650232 | +----+---------+----------+ If I perform the following query: SELECT `id`, S...

mscorlib exception

Can anybody tell me what is wrong with my web app based on following exception? I am getting this when I try to run this project from VS2008: System.Security.SecurityException was unhandled Message="Request for the permission of type 'System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.0.0, Culture=neutral, Publ...