sql

Is there an automatic modification time stamp type for Oracle columns?

Is there a way to create a timestamp column in Oracle that automatically stores a timestamp of when the record has changed ? ...

Any set of rows that add up to target number

I have the following data in the table SALES: BillItemID CustID BillDate Item BillAmt 1001 1 09-10-01 Suit $50.00 1002 1 09-10-01 Shirt $20.00 1003 1 09-10-01 Pants $20.00 1004 1 09-10-01 Tie $5.00 1005 1 09-01-10 ...

SQL Query : List the Most frequent Users of a Server

I am working on a one to many query for an assets database. Here is some sample data Server Name Application Primary_User Server1 SQL DBA Server1 Citrix IT Server1 Oracle DBA Server2 Sharepoint Web Server3 SQL ...

is there a way to do multiple left outer joins in oracle?

Why wont this work in oracle? is there a way to make this work? FROM table1 a, table2 b, table3 c WHERE a.some_id = '10' AND a.other_id (+)= b.other_id AND a.other_id (+)= c.other_id I want table1 to be left outer joined on multiple tables... If I try to change it to ANSI join I get compilation errors. I did the following:...

Modify PL/SQL statement strings in C++

Hello all, This is my use case: Input is a string representing an Oracle PL/SQL statement of arbitray complexity. We may assume it's a single statement (not a script). Now, several bits of this input string have to be rewritten. E.g. table names need to be prefixed, aggregate functions in the selection list that don't use a column ali...

How do I bulk Insert using SubSonic?

I have something that looks like this foreach (var user in NewUsers) { var dbUser = new User {FirstName = user.FirstName}; dbUser.Save(); } That is too many inserts into the database. Can I do something like? User.BulkInsert(NewUsers); Thanks. ...

How do I retrieve a file from a SQL Server database?

I have successfully uploaded files into my SQL Server database. I can bring back the information into a GridView. I am unable to figure out how to create a hyperlink to actually open the file. ...

How to use SqlBulkCopy with nullable columns

I’m having an issue using SqlBulkCopy when nullable columns are involved. It sounds like SqlBulkCopy doesn't know how to deal with nullable columns and throws an illegal size error when it encounters a zero length column. The error is "Received an invalid column length from the bcp client..." I’m wondering what the best practice is for ...

SQL Server: Need to find the origin of a particular string value

Is there a way I can search for a particular string value in a SQL SERVER 2005 database? I have this image path value that I want to modify and I think it's stored in the database. Also - is there a way that I can search for a column's name for any table in a database? Likewise, search for a tables name in a database? ...

php and mysql selecting 5 rows from mysql

i am tryng to select 5 mysql rows from the database and display them like $row[1] ect.... in php i am not sure how to do it an someone lead me down the right way please Ok i hav looked a bit more i wanted it to come out 1 - 5 and i wanted it to display the names $result = mysql_query("SELECT * FROM table ORDER BY id DESC") or die (m...

SQL Query Help for Queue Quantities

I have a database which has an orders table and inventory table. The order-items table has a 1 record per 1 qty layout, so if a person places an order for 7 'ABC's, and 4 'XYZ's, I get 11 records in the table. id, item, qtyNum 01 ABC 1 02 ABC 2 03 ABC 3 04 ABC 4 05 ABC 5 06 ABC 6 07 ABC 7 08 XYZ 1 09 XYZ 2 10 XYZ 3 11 XYZ 4 The...

Table vs Temp Table Performance

Which is faster for millions of records: Permanent Table or Temp Tables? I have to use it only for 15 million records. after Processing complete. we delete these records.. ...

SQL Server - Get Inserted Record Identity Value when Using a View's Instead Of Trigger

For several tables that have identity fields, we are implementing a Row Level Security scheme using Views and Instead Of triggers on those views. Here is a simplified example structure: -- Table CREATE TABLE tblItem ( ItemId int identity(1,1) primary key, Name varchar(20) ) go -- View CREATE VIEW vwItem AS SELECT * F...

DATE_ADD functionality in Ingres

Many (most? nearly all?) SQL dialects have a way to perform this type of function: date_add( MyDate, MyInterval ) I've been through all of the docs, but I cannot find this functionality in Ingres. My immediate goal is to get "MyDate plus 3 months". Does anyone know if there is a simple way to do this that I'm missing? Note: I realize t...

Sql Server 2000: Return "true" or "false" based on any 1 of 25 columns being "true"

Hi, I have to create a query that checks across several different columns, and if any of them have a 1, I want to return true. Ideal output would be along the lines of: ID:55 Name:John Doe IsDealerType1:True IsDealerType2:True IsDealerType3:False IsDealerType4:False IsDealerType5:True The problem is, instead of those 5 dealer col...

How to create SQL query for "Likes in common"

Currently I'm building a system (php and mysql), that on the user profile allows you to add "favorite music artists" to a list. 've been trying to figure out a way to compare the user likes to other users and return a "recommended friends". For example: User A Likes - 1 - 2 - 3 - 4 User B Likes - 1 <- A likes - 5 - 6 - 7 User C Likes...

Data in Sql Server should use Unicode?

I want to store English, French, German, Italian, and Spanish in a Sql Server 2005 database to be used with a .NET application. Can I get away with not using Unicode? Will there be any issues with these languages? ...

T-SQL - create partition function and scheme - SQL Server 2008

I am creating partition function and schemes. In SQL Server 2008, it only defines range partitioning and not list partitions. Dont we have list partitioning in SQL Server? I am using SQL Server 2008 Enterprise edition. ...

Converting non-unicode SQL Server data and stored procs to Unicode

I need to convert a non-unicode SQL Server 2005 database to a unicode based database. I have hundreds of stored procs and of course the data is stored in varchar. I know that I need to change all the data types to the unicode equivalent (varchar to nvarchar) but don't I have to change how the stored procs are written or will they conti...

CONTEXT_INFO() and CONVERT

In an attempt to build example code for this question, I ran into a problem with CONTEXT_INFO(). What I'm doing is converting an int to varbinary(128) so I can pass that to SET CONTEXT_INFO. I can convert the varbinary back to int before I do the SET, but after I SET and then GET, the CONVERT always returns zero even though the varbinar...