sql

How do I know Connection Pooling and Prepared Statements are working?

I have been developing a web application for almost a year which I had started in college. After finishing, I made some changes to the database code that I had written during college. I used simple JDBC when I was in college, without the use of connection pooling and prepared statements. In the past month, I have realized the potential, ...

mysql query browser: is it possible to undo change?

ive updated a table in a database using mysql query browser. is it possible to roll back? ...

mysql: or/and question

is this: update batchinfo set instrument='Instrument 17' where datapath like '%10497%' or datapath like '%10506%' or datapath like '%10516%' or datapath like '%11081%' and instrument='Instrument 1' the same as this: update batchinfo set instrument='Instrument 17' where datapath like '%10497%' and instrument='Instrument 1' or dat...

Storing data for web application in python dictionary

Is it feasible to store data for a web application inside the program itself, e.g. as a large dictionary? The data would mostly be just a few hundred short-ish text blocks (roughly blog post size), and it will not be altered/added to at all by the users (although I would want to be able to update it myself every so often). Up until now...

What type is this: ISNULL(SUM(COALESCE (a.currency, 0)), 0)

I have the following piece of sql query: Sql += " SELECT ISNULL(SUM(COALESCE (a.currency, 0)), 0) AS monthCurrency FROM IW_Awards AS a "; The query works fine, I am trying to cast this value in C# after the query has been submitted and I cannot find what type it is. I tried int, int? and string. When I trie...

Run SQL job from Ruby on Rails App

Is it possible to run a SQL job from Ruby on Rails application? ...

What is a Projection?

What is a Projection, in terms of database theory and NHibernate when using SetProjection()? ...

How can I view the original SQL that created a stored procedure in SQL Server 2008?

The title pretty much says it all. How can I view the original SQL that created a stored procedure in SQL Server 2008? Is this possible? I've been searching online for some leads, but I'm either missing correct vernacular or I'm just looking for something that can be found by some other means. My basic problem is that I've got a SQL ...

Query to pull all the table names and column names.

I need a query (ORACLE) to pull all the table names and column names in a database for a given value? Example: If I give a value as "TEST", I need a query which pulls all the TABLE_NAMES and COLUMN_NAMES which has the value "TEST". ...

SQL Server optimize code in Stored Procedure

Comparing two codes below,both do the same,but with slighty differences: ALTER procedure [dbo].[SP_USUARIOS_UPDATE] @usu_ds varchar(100), @usu_dt_lst_log datetime, @usu_ds_senha varchar(255), @usu_ds_email varchar(100) as begin declare @usu_ID int; create table #TempUser ( UsuID int, S...

ASP MVC 2 Uploading file to database (blob)

Hi, I am trying to upload a file via a form and then save in in SQL as a blob. I already have my form working fine, my database is fully able to take the blob and I have a controller that take the file, saves it in a local directory: [AcceptVerbs(HttpVerbs.Post)] public ActionResult FileUpload(int id, HttpPostedFileBase uploadF...

Create foreign key without checking existing data

This is a 2 part question. Question 1: I am trying to create a foreign key on a table where I need to turn off the "Check Existing Data on Creation or Re-Enabling". I know theres an option visually but I'm looking for a way to do it programmatically. Is there anyway to do this? Question 2: I have a code table and two tables A and B tha...

MySQL Query : Select existing months from database and complete dynamically with the rest of year's month

Hi all, I have two tables: CREATE TABLE 'sales_sheet' ( `_id` int(11) NOT NULL AUTO_INCREMENT, `_typed_by` int(11) DEFAULT NULL, `_product_id` int(11) DEFAULT NULL, `_year` date DEFAULT NULL, `_validation_state` int(11) DEFAULT NULL, PRIMARY KEY (`_id`), KEY `_product_id` (`_product_id`) ) ENGINE=MyISAM DEFAULT CHARSET...

SQL Express Connection String - Initial Catalog

Wonder if anyone can help, I have created a database in C# 2010 (using the SQL Express installed with C# express) via the database explorer. I can connect to the database using the connection string: Data Source=.\SQLEXPRESS;AttachDbFilename=C:\temp\Documents\test.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True ...

Setting column constraint on a table (SQL Server)

I have a column that should contain one of values of 2 power n: 2,4,8,16,32 etc. I want to enforce that on table schema level - is there a way to specify such a column constraint? Thanks! ...

Create a temp table in PL/SQL

I'm working with an Oracle 10g database, and I want to extract a group of records from one table, and then use that for pulling records out of a bunch of related tables. If this were T-SQL, I'd do it something like this: CREATE TABLE #PatientIDs ( pId int ) INSERT INTO #PatientIDs select distinct pId from appointments SELECT * fr...

LINQ to SQL INSERT WHERE not in collection

I need to mirror all of the DNS entries on our DNS server in a SQL database. I am able to query DNS using WMI and C#. And I can query SQL for existing records using L2S but there is a lot of room for improvement. What does the LINQ To SQL statement look like that will insert records that are not in the ManagementObjectCollection returne...

SQL subquery/join

Hello, Well I am a beginner in SQL so plz excuse if this problem is too novice for you. In Northwind (Am sure everyone is aware of Northwind) - I an trying to get for each month the product that sold (by quantity) the most and the one that sold the least in the year 1997 (usind orders, order details, product tables) Thanks UPDATE: Th...

SQL Server connecting to another SQL server?

So I have 2 SQL servers, both internal on the firewall, and my webserver is on the DMZ. The webserver currently connects to one of the SQL servers for it's data. I need some information from the other SQL server which I cannot connect to from the DMZ because of security risks that the company is not willing to take. How can I connect ...

SQL: Having trouble with query that gets percentages using aggregate functions

Hello all, I'm not an expert in SQL by any means, and am having a hard time getting the data I need from a query. I'm working with a single table, Journal_Entry, that has a number of columns. One column is Status_ID, which is a foreign key to a Status table with three values "Green", "Yellow", and "Red". Also, a journal entry is logged ...