sql

DB2 - Modifies SQL Data

I have a stored procedure in db2 that is causing sqlcode=-577 errors. The reason for this i think is that i have not set the 'modifies sql data' clause on my procedure. is there any way to do an alter procedure to set this clause, or will i have to drop and recreate the procedure? thanks ...

Efficiently storing 7.300.000.000 rows

How would you tackle the following storage and retrieval problem? Roughly 2.000.000 rows will be added each day (365 days/year) with the following information per row: id (unique row identifier) entity_id (takes on values between 1 and 2.000.000 inclusive) date_id (incremented with one each day - will take on values between 1 and 3.65...

Access SQL many to many query

Hi, I have three tables: Author(AID, Name) Title(TID, Name) AuthorOfTitle(ID, AID, TID) My question is how do can I see only Authors that are connected to no titles, that is Authors where there is no record in AuthorOfTitle. How to do this in SQL. Btw am using MS Access 2007. ...

Informix: Select null problem

Using Informix, I've created a tempory table which I am trying to populate from a select statement. After this, I want to do an update, to populate more fields in the tempory table. So I'm doing something like; create temp table _results (group_ser int, item_ser int, restype char(4)); insert into _results (group_ser, item_ser) select ...

Notifying app from SqlServer

Given a typical 3 tiers app deployed at two remote sites. The db behind the two installations contains exactly the same structure and same data. There needs to be a replication mechanism between the two backend db to keep them in synch. The native replication feature of SqlServer would do the job. However, the business layer of the app k...

Rows Into Columns and Grouping

I have a query that looks like this: SELECT OrganizationName, OrganizationID, ReceivableStatus, InvoiceFee FROM v_InvoicesFreelanceOutstanding ORDER BY OrganizationID The data from that might look like this: OrganizationName OrganizationID ReceivableStatus InvoiceFee --------------------------------------------------...

group by first character

hello friends i have a problem in oracle -sql. i have a query please solve out it i have a column first_name in employees table. i want to group my records according to first character of column first_name. like if i have 26 name from (A-Z) in column first_name then there should be 26 group according to alphabates. i tried following...

SELECT All that are not in another table

Hi All, I've inherited a less-than-ideal table structure, and I'm trying to improve it as much as I can without tearing down and rebuilding. There's currently at least two levels of data for everything, the legacy data and the marketing override data. I'm trying to find all the records within the legacy data that don't yet have a mark...

How to find persons who are absent continuously for n number of days?

Database: MS SQL 2005 Table: EmployeeNumber | EntryDate | Status Sample Data: 200 | 3/1/2009 | P 200 | 3/2/2009 | A 200 | 3/3/2009 | A 201 | 3/1/2009 | A 201 | 3/2/2009 | P Where P is present, A is absent. I have tried row_number over partion. But it does not generate the sequence which I expect. For the above data the sequence...

Create a new db user in SQL Server 2005

how do you create a new database user with password in sql server 2005? i will need this user/password to use in the connection string eg: uid=user;pwd=password; ...

Pivot against a SQL stored procedure (or LINQ)

I am trying to create a Stored procedure (or query expression) that Pivots on a grouping ID. After looking at the examples here and elsewhere I have failed to get my pivot statements to work in a stored procedure, and I am looking my help. Also, if this could be done with LINQ on a LIST that would be a solution for me also. theID ...

Difference between mysql and sql server? Performance, features,...?

What are the differences between MySQL and Sql server? What are the parameter to chose between the two? ...

MySQL Duplicate rows

I have a table with some repeated information: Id, Name, Lastname, Birth, PersonalKey, Personal Info, Direction, Source. Where source tells me where the information came from. The repeated information has unique id, and I need to erase the duped information. But, I have priority over some Source information that i need to be the one t...

When shouldn't you use a relational database?

Apart from the google/bigtable scenario, when shouldn't you use a relational database? Why not, and what should you use? (did you learn 'the hard way'?) ...

Best method to populate XML from SQL query in ASP.NET?

I need to create a service that will return XML containing data from the database. So I am thinking about using an ASHX that will accept things like date range and POST an XML file back. I have dealt with pages pulling data from SQL Server and populating into a datagrid for visual display but never into XML for delivery, what is the best...

SQL Server 2005 - Linked Servers & Agent Jobs

I have a strange scenario that I am currently unable to explain. I live in hope that it's just "the Friday feeling" or that some kindly sole here will bail my brain out and save me from endless loops of "but why!?" :) Two servers, running SQL Server 2005, with DNS Entries of: 1. ServerA 2. ServerB (Well, they're not really calle...

SQL Schema to allow users add comments to various tables

So, I'm building a website and I'm going to have standard CMS tables like Article, Blog, Poll, etc. I want to let users post comments to any of these items. So my question is, do I need to create separate comments tables for each (e.g. ArticleComment, BlogComment, PollComment), or can I just make a generic Comment table that could be u...

How to outer-join two tables (main and many-to-one sub-table) to get only ONE item from second table?

I have two tables that are something like this: Main table: id (int), title (varchar), etc. Sub-table: main_table_id (foreign key into main table), tag (varchar), etc. There can be zero or more subtable rows for a given row in the main table. I want to do a query that will return every row of the main table, with the columns of the...

Adding Content Database with STSADM, but failing to connect to SQL Server

I'm trying to add a content database to my MOSS 2007 site, but I can't seem to connect to the SQL Server. I run the following from the command prompt: stsadm -o addcontentdb -url htt://testserver:101 -databasename WSS_ Content_MySite -databaseserver SHAREPOINT01 STASADM gives me this error: "An error occured while establishing a conne...

SQL Server - OPENXML how to get attribute value

I have the following XML: <Field FieldRowId="1000"> <Items> <Item Name="CODE"/> <Item Name="DATE"/> </Items> </Field> I need to get the FieldRowId using OPENXML. The SQL i have so far: INSERT INTO @tmpField ([name], [fieldRowId]) SELECT [Name], --Need to get row id of the parent node FROM OPENXML (@idoc...