sql

connection string with no user name and password, asp.net

i have a website built in asp.net connecting to a sql 2000 db. within my web.config file, i have a connection string referencing a DSN. in order for my db connection to work i have to include the username and password within the string. for security reasons, is there any way to connect to my db without displaying the username and passwo...

Oracle SQL Developer - Missing IN or OUT parameter at index:: 1

Hi, I am having trouble testing this simple stored procedure in Oracle Sql Developer. The stored procedure does a simple select and returns a cursor. create or replace PROCEDURE GET_PROJECT_DRF_HISTORY ( projectId IN NUMBER, resultset_out OUT sys_refcursor ) AS BEGIN OPEN resultset_out for SELECT * from GLIDE_HISTORY where G...

HSQLDB cryptic exception message: "feature not supported"

I have JDBC code which inserts into a database table by executing a PreparedStatement. When I run the code on an in-memory HSQLDB database (as part of a JUnit test) I get a SQLFeatureNotSupportedException with the only information being the message "feature not supported" and the vendor code -1500. What I'm doing is a basic insertion i...

many to many select query

I'm trying to write code to pull a list of product items from a SQL Server database an display the results on a webpage. A requirement of the project is that a list of categories is displayed at the right hand side of the page as a list of checkboxes (all categories selected by default) and a user can uncheck categories and re-query th...

SQL Query to get table name and number of rows based on column name"

Hello Everyone, I have declared a Cursor to get table names and no of columns in that tables based on column names.Please find the below query table name is not get inserted.Please suggest. Create table #t ( tabname varchar(500), NoOfRows bigint, ) Declare @Namee Varchar(500) Declare @GetName Cursor Set @Getname = Cursor for Sele...

SELECT MAX() function in MySQL

I'm trying to figure out a problem I'm having with a SELECT MAX() command. I want to gather the highest value in the 'BidAmount' column, but I only want selected entries to be scanned for the highest value. For example, I want the highest 'BidAmount' to be returned where another column 'UserID' = 6. I want to know the highest 'BidAmoun...

mysql query help?

( SELECT u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m.dt FROM relationships r JOIN notes m ON m.user_id = r.leader JOIN user u ON r.leader = u.user_id WHERE r.listener ='2' ) UNION ALL ( SELECT u.username, u.picture, m.id, m.user_note, m.reply_id, m.reply_name, m.dt FROM notes m JOIN user u ...

Many-to-many link table design : two foreign keys only or an additional primary key?

Hello experts, this is undoubtedly a newbie question, but I haven't been able to find a satisfactory answer. When creating a link table for many-to-many relationships, is it better to create a unique id or only use two foreign keys of the respective tables (compound key?). Looking at different diagrams of the Northwind database for exam...

How to connect MS Access to hosted SQL database?

How to create ODBC or DSN file for connection so that Access Linked Tables are pointing to hosted SQL Tables? ...

Add Oracle DB as Linked Server

Hi everyone, I am using Windows 7 64 bit, but my Oracle Server I am trying to connect is 32 bit, and so is the SQL Server 2008 and Oracle Client on my machine. I have installed Oracle 10g client (32 bit) with administration tools on my machine and setup Net Services to connect to database. I can connect to all the databases through SQL...

SQL - Specified Alphabetical Order

I want a specific order for the Completion_Status column as in: Completed, Passed, Incomplete & Failed How do I do I order this? I want to define the order above. I tried CASE but it give me an error as in Expecting NUM not CHAR. select DISTINCT u.first_name || ' ' || u.last_name "Employee_Name", rco.title "Course_Name", deco...

How can I get the 'External name' of a SQL CLR trigger?

I have created a SQL CLR trigger with the follow SQL: GO CREATE TRIGGER AuditAccountsTable ON [dbo].[Accounts] FOR INSERT,DELETE,UPDATE AS EXTERNAL NAME namespace.Triggers.AuditTrigger I am trying to query: select * from sys.triggers Is there a way to find the: EXTERNAL NAME namespace.Triggers.AuditTrigger on the trigger fro...

IIS 5.1, MVC 2, SQL Server 2005 deployement error

Hello, I have deployed a solution correctly on IIS 5.1 (hopefully) as it loads up and shows a "User not authorised page which I created myself". The fact this shows is a good sign but it also hides any errors as I think I should be authorised. To try an get an error message I ran a method on a controller which didnt require any author...

How to use a SQL for loop to insert rows into database?

I'm using Postgres, and I have a large number of rows that need to be inserted into the database, that differ only in terms of an integer that is incremented. Forgive what may be a silly question, but I'm not much of a database guru. Is it possible to directly enter a SQL query that will use a loop to programatically insert the rows? ...

Filter results by Product Type and Sort List by Price (PHP/SQL)

I'm in the process of learning how to create an e-commerce site. I'm trying to figure out how to order product results by price. Code below is a menu list to either filter a specific product category or the option to view all products--the code for that works. I'm not sure how to add code to "sort by price" (low to high, high to low). I...

first day of the same month

Hi,I have a date parameter (@rptMonth) that is selected by the user from a datepicker calendar. The date must be the first day of the month. No matter what the user selects I'd like to turn that into mm/01/yyyy. For example- I need the first day of the month. So if the user selects 06/22/2010, I need to turn that into 06/01/2010. So in m...

Oracle SQL returns rows in arbitrary fashion when no "order by" clause is used.

Maybe someone can explain this to me, but when querying a data table from Oracle, where multiple records exist for a key (say a customer ID), the record that appears first for that customer can vary if there is no implicit "order by" statement enforcing the order by say an alternate field such as a transaction type. So running the same ...

How to select specific changes using windowing functions in postgres.

I have a table with some foreign keys, I need to get a report of when these keys change. from | to | timestamp 1 | 2 | 0000 1 | 2 | 0001 1 | 2 | 0002 1 | 3 | 0003 1 | 3 | 0004 1 | 2 | 0005 SELECT from,to,FIRST(timestamp) FROM table GROUP BY from,to; from | to | timestamp 1 | 2 | 0000 1 | 3 | 0003 I...

Create an aggregate function for GROUP BY?

I have a query that outputs results as follows: Person Food ====== ====== Abner Apple Beth Banana Beth Peach Carlos Grape Carlos Kiwi Carlos Strawberry . . . . Namely, it associates a person with one or more foods. I'd like the functionality of an aggregate function to choose a food, but none of the built-in ...

MySQL intersection in subquery

I'm trying to create a filter for a list (of apartments), with a many-to-many relationship with apartment features through the apartsments_features table. I would like to include only apartments that have all of some features (marked 'Yes' on a form) excluding all the ones that have any of another set features (marked 'No'). I realized ...