sql

I need to show excel data on a presentable web page or word doc?

I have survey results which are formatted in excel fine. I then need to show these results indivually wiht the headings on a presentable word doc or wewb page? s there any weay to do this. For example: column one - comlumn 2 result 1 - result 1 result 2 - result 2 to comlumn 1 result one column 2 result one column 1 res...

Best way to implement a stored procedure with full text search

I would like to run a search with MSSQL Full text engine where given the following user input: "Hollywood square" I want the results to have both Hollywood and square[s] in them. I can create a method on the web server (C#, ASP.NET) to dynamically produce a sql statement like this: SELECT TITLE FROM MOVIES WHERE CONTAINS(TITLE,'"holly...

Duplicate set of columns from one table to another table

My requirement is to read some set of columns from a table. The source table has many - around 20-30 numeric columns and I would like to read only a set of those columns from the source table and keep appending the values of those columns to the destination table. My DB is on Oracle and the programming language is JDBC/Java. The source...

How much does wrapping inserts in a transaction help performance on Sql Server?

Ok so say I have 100 rows to insert and each row has about 150 columns (I know that sounds like a lot of columns, but I need to store this data in a single table). The inserts will occur at random, (ie whenever a set of users decide to upload a file containing the data), about a 20 times a month. However the database will be under conti...

Can anyone show me why my SQL query isn't working (see details)?

I used the following query to find duplicates: SELECT userID, COUNT(userID) AS NumOccurrences FROM userDepartments GROUP BY userID HAVING ( COUNT(userID) > 1 ) I then tried adding an inner join so I could see the user names that match, which are stored in a different table. SELECT userDepartments.userID, users.firstname, users.lastna...

How to create a nonclustered index in a hibernate mapping?

If I want to specify some nonclustered indices in a hibernate mapping as follows: CREATE NONCLUSTERED INDEX [Index_name] ON [dbo].[Individual] ( [ID] ASC, [IsActive] ASC )WITH (SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF) ON [PRIMARY] what's the best way to do it for multiple tables that a...

Need help with Database Terminology

If you have data in one table that should be in another table, what is their relationship called? ...

What SQL coding standard do you follow?

Is there any widely used SQL coding standard out there? SQL is little bit different from C/C++ type of programming languages. Really don't know how to best format it for readability. ...

Why does a SQL join choose a sub-optimal query plan?

Ok so I realize that this is a pretty vague question, but bear with me. I have experienced this problem on numerous occasions with different and unrelated queries. The query below takes many minutes to execute: SELECT <Fields> FROM <Multiple Tables Joined> LEFT JOIN (SELECT <Fields> FROM <Multiple Tables Joined> ) ON <Condition> ...

Handling Many Statistic DB Columns With Order By Requirements

For my current project we want to present statistical data and rank it. For my case I'm talking about "Favouriting" of an artist, counting the times an artist's track has been played, displaying a count of how many playlists an artists track has been added to a playlist... These are all very domain specific issues, but it's a concrete ex...

To fix the run-time error: "Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information" How do I generate a primary key?

My code works. After I copy about 10 tables I get an error. Dynamic SQL generation for the DeleteCommand is not supported against a SelectCommand that does not return any key column information. Okay, I know I need to generate a primary key. But why can I copy 10 or so tables over, and THEN I get the error. Does each row have to return a...

Help with SQL query.

Hello. I have the following table on a MySQL 5.1.30: CREATE TABLE article ( article_id int(10) unsigned NOT NULL AUTO_INCREMENT, category_id int(10) unsigned NOT NULL, title varchar(100) NOT NULL, PRIMARY KEY (article_id) ); With this information: 1, 1, 'foo' 2, 1, 'bar' 3, 1, 'baz' 4, 1, 'quox' 5, 2, 'quonom' 6, 2, 'qox' ...

When should you consider indexing your sql tables?

How many records should there be before I consider indexing my sql tables? ...

how to search from html formatted text in sql

i'm using mssql 2000. i have 3 problem. My web site save some data to html formatted text into ntext field. how to search from this field? Before i ask question named by how to search from all field in sql. But i need to get which field found search result? I save some field using .NET encryption. How to search from this field. It is ...

Rewriting a MySQL query

I'll try to explain this better on another question. This is the query that I think should work but, off course, MySQL doesn't support this specific subselect query: select * from articles a where a.article_id in (select f.article_id from articles f where f.category_id = a.category_id order by f.is_stic...

Is there efficient SQL to query a portion of a large table

The typical way of selecting data is: select * from my_table But what if the table contains 10 million records and you only want records 300,010 to 300,020 Is there a way to create a SQL statement on Microsoft SQL that only gets 10 records at once? Eg select * from my_table from records 300,010 to 300,020 This would be way more ef...

How to display group data seprately using DataList in ASP.NET?

Hi, I have a sql table which have the following data, Id City Country --- ------ ------------ 1 Delhi India 2 New York United States 3 Karachi Pakistan 4 Mumbai India 5 Lahore Pakistan 6 Kanpur India 7 Delhi India 8 Mumbai India Now, I want to display the above data in my web...

sql left join and duplicates in result

Say I have 2 tables, A and B, each A entity can possibly have multiple B entities, in one case if I want to get all B's of some certain A's, I might do it with a simple left join select A.id aid,B.id bid from A left join B on B.aid = A.id where A.id = 1 and it will return a result set like aid bid 1 1 1 2 1 3 As you...

Union or Use Flow Control Logic to Determine which table to report on

I'm working with a 3rd pary app where I can't alter the tables. We built custom matching "Monthly" tables with an additional datetime column "AsOfDate" where we dump the data at the end of the month and flag those data with the date of last day of the month. I want to be able to create a single Stored Procedure (Application is designed ...

Update trigger behavior in SQL 2005

I used an Update statement inside a procedure to update a table which has an update trigger. Does the update statement complete after the trigger completes or what? ...