sql

SQL Server Intergration Services 2005 - How do I get a directory listing.

In SQL Server Integration Services 2005, how do I read a directory so I can then process all of the files in that directory? ...

database datatype size

Just to clarify, by specifying something like VARCHAR(45) means it can take up to max 45 characters? I remember I heard from someone a few years ago that the number in the parenthesis doesn't refer to the no of characters, then the person tried to explain to me something quite complicated which I don't understand and forgot already. And...

SQL Reporting Services - Subreports Broken into multiple columns

Hi, I inherited an SQL Reporting Services .rdl project from somebody and need help fixing some functionality. In each row of the report, there is a subreport. In order to save space the subreport is divided into 3. Such that in each row of the report, it splits the data of the subreport into 3 smaller tables. Right now, it fills these ...

Oracle SQL: ROLLUP not summing correctly

Hi guys, Rollup seems to be working correcly to count the number of units, but not the number of trains. Any idea what could be causing that? The output from the query looks like this. The sum of the Units column in yellow is 53 but the rollup is showing 51. The number of units adds up correctly though... And here's the oracle SQL ...

dynamically creating the #temp table and then used to insert the data

Hi All, I am importing an intermediate result of query into a temp table for further use, so I used a #temp table to maintain the same schema as select * into # temp from schema.tableName where 1<>1; insert into # temp from exec(table) While I am doing this statement as a variable to pass the different tableName its not working SET ...

SQL Grouping with multiple joins combining results incorrectly

Hi I'm having trouble with my query combining records when it shouldn't. I have two tables Authors and Publications, they are related by Publication ID in a many to many relationship. As each author can have many publications and each publication has many Authors. I want my query to return every publication for a set of authors and i...

Algorithm for Search page

Hi All, I am creating a search page where we can find the product by entering the text. ex: Brings on the night. My query bring the records which contain atleast word from this. Needs: 1. First row should contains the record with the given sentence. 2. second row next most matching. 3. Third row next matching ...etc How to ac...

Help with SQL query (list strings and count in same query)

Hi everybody, I’m working on a small kind of log system to a webpage, and I’m having some difficulties with a query I want to do multiple things. I have tried to do some nested / subqueries but can’t seem to get it right. I’ve two tables: User = {userid: int, username} Registered = {userid: int, favoriteid: int} What I need is a q...

Pivot function in sql server 2008

how to carry out the pivot function i have a table with datas Day Period subject fromtime totime ---------------------------------------------- Monday 1st English 9:30 10:15 Monday 1st English 9:30 10:15 Monday 5th English 1:30 2:20 Monday 8th English 3:40 4:30 but i need the format as d...

Good book for sql

I always considered database as a storage . but never thought it can be used for querying across tables etc. Which is a good book for sql for a developer. not just the syntax. How to write a query in different ways How internally queries are executed.etc especially related to microsoft sql server ...

Implementing database redundancy with sharded tables

We're looking to implement load balancing by horizontally sharding our tables across a cluster of servers. What are some options to implement live redundancy should a server fail? Would it be effective to do (2) INSERTS instead of one ... one to the target shard, and another to a secondary shard which could be accessed should the pri...

Stop the user entering ' char

I have a search page where I would like to stop the user entering a ' into textboxes, or replace it with a suitable character. Can anyone help me achieve this in asp.net vb ? For example if a user searches for O'Reilly the search crashes with error: Line 1: Incorrect syntax near 'Reilly'. Unclosed quotation mark before the character ...

IntegrityError: foreign key violation upon delete

I have Order and Shipment model. Shipment has a foreign key to Order. class Order(...): ... class Shipment() order = m.ForeignKey('Order') ... Now in one of my views I want do delete order object along with all related objects. So I invoke order.delete(). I have Django 1.0.4, PostgreSQL 8.4 and I use transaction middleware...

Two n x m relationships with the same table in mysql

I want to create a database in which there's an n x m relationship between the table drug and the table article and an n x m relationship between the table target and the table article. I get the error: Cannot delete or update a parent row: a foreign key constraint fails What do I have to change in my code? DROP TABLE IF EXISTS `textmi...

Sub-Schemas in SQL Server 2005/2008

This is a simple question yet I was unable to find any information at all about this. Is it possible to have sub-schemas in SQL Server 2005/2008? Example: Having a HR (Human Resources) schema with a sub-schema called Training (with tables related to this). It would end up like HR.Training.* where * would be the tables. ...

Return order of MySQL SHOW COLUMNS

Hey guys. Simple one this, but one I can't seem to find any information on so here goes. I need to find the columns in a specific table, which is no problem.... SHOW COLUMNS FROM tablename LIKE '%ColumnPrefix%'; But I need to know what order they will be returned, preferable by choosing to order the results ascending alphabetically. ...

Error when using Transfer in Microsoft SMO namespace

Hi, I'm writing an ASP.NET app in c# that will allow users to upload databases from local sql 2005 server to a remote sql server. The code does not run directly on the local sql server, it runs on an adjacent server. The error I receive when I run the code is: ERROR : errorCode=-1073659874 description=The file name "C:\Documents and...

cross tab query

Hi guys, I have a project table with the following columns ProjectID, ProjectDescription and a list data table which has the following columns ProjectID ListType Date Memo Every project has many list type entries in the ListType Table. What I want to do is run a query which will return something like this ProjectID, ProjectDescri...

Select result in single cell

How can i select all id's for records in single cell? For example: --example select of all values select id, name, address, phone from table And get all id's where phone like '%555%' and show them in single field like: '111 123 234 321 231 234' ...

in mysql table update 'a' record with 'b' and 'b' with 'a'

IN my table there are two field one is name and other is gender I want to fire query so that every male is update with female and vice a versa. I don't want to use procedure ,trigger or function.I have to do this only with simple query. ...