sql

UDF Performance in MySQL

I'm noticing exponential performance degradation in MySQL query execution times when queries include calls to UDF's in the SELECT or WHERE clauses. The UDF's in question query local tables to return scalar values - so they're not just performing arithmetic expressions, but serving as correlated subqueries. I've fixed the performance pr...

How do I store changing data into a database?

I made an application to take the now playing title and artist from an internet radio stream, and I have it displaying in plain text on this page: http://thelisthq.net/z1035.php The output is simply a php 'echo $variable' command, but $variable is constantly changing, so how do I store each different value of $variable into a database....

SQL Database design question

I am grappling with a database design issue at the moment, I will present a simplified scenario of what is going on: Lets say I have four tables, Equipment, CurrentState, StateValue, StateType with the following schemas: Equipment ------------ Id (PK), Name CurrentState ------------ Id (PK), EquipmentId (FK) (IX), StateValueId (FK), ...

Reading a part of a alpha numeric string in SQL

I have a table with one column " otname " table1.otname contains multiple rows of alpha-numeric string resembling the following data sample: 11.10.32.12.U.A.F.3.2.21.249.1 2001.1.1003.8281.A.LE.P.P 2010.1.1003.8261.A.LE.B.B I want to read the fourth number in every string ( part of the string in bold ) and write a query in Oracle 10g...

how can i store,update and delete that image?

I am doing a project related to Student information.Front-end tool is java And back-end tool is SQL.I want to place a image of student.how can i store,update and delete that image? ...

Tricky SQL SELECT Statement

Hello, I have a performance issue when selecting data in my project. There is a table with 3 columns: "id","time" and "group" The ids are just unique ids as usual. The time is the creation date of the entry. The group is there to cummulate certain entries together. So the table data may look like this: ID | TIME | GROUP -----...

Ruby/Rails - Implicitly create a parent record when creating a child record?

Ok this is a bit unusual, but I have a series of data collection forms that save data to their respective models. What I want to do is auto insert a common parent (activity/event log - separate model) record that will be common to each form. (All forms will save an implicit record in this model, before saving the child record). So the sa...

SQL: selecting multiple rows per group

I have some records in my table tbl1. There is a column s, based on which I need to retrieve the rows where datateime1 is an old date. If I try the query shown below I seem to get correct results. Now I try to get the two oldest rows of the s1 group. I tried by adding 's1' twice to the IN clause, but that does not work, because the row...

SQL Server add job agent T-SQL script issue

Hello everyone, I am using SQL Server 2008 Enterprise. I have created a very simple test SQL Server Agent job which just print out a string. And then I add a schedule to let the job run once a day. Then I select from SQL Server Management Studio => Jobs => Select the test job => Script Job as => Drop and Create To, here is the generate...

import data from one table to another table

Hello everyone, I am using SQL Server 2008 Enterprise. I need to import all data from Server/Instance "Server Foo", Database "Foo" and table "Foo", into destination Server/Instance "Server Goo", Database "Goo" and table "Goo". Table Foo and Table Goo are of the same schema. If the same row exists for table Goo, I want to keep the origin...

metaprogramming with stored procedures?

This is going to be both a direct question and a discussion point. I'll ask the direct question first: Can a stored procedure create another stored procedure dynamically? (Personally I'm interested in SQL Server 2008, but in the interests of wider discussion will leave it open) Now to the reason I'm asking. Briefly (you can read more e...

xml to oracle DB table : encountering problems

Hi, I have a sample xml file created using Editplus( in windows). < ?xml version="1.0" encoding="UTF-8" ?> < badges > < row UserId="3714" Name="Teacher" Date="2008-09-15T08:55:03.923"/> < row UserId="994" Name="Teacher" Date="2008-09-15T08:55:03.957"/> < / badges> My goal here is to get this information into Oracle DB...

How to use Wordnet in SQL

How to use Wordnet in SQL database. Does it exists anywhere can someone give me step by step procedure ...

Updating multiple columns of a table

I've two tables with the following fields: table1 : OTNAME table2 : SNCODE, description_text I'm trying to add the two columns of table2 to table1 and update the columns. My query is: alter table table1 add sncode integer alter table table1 add description_text varchar2(30) update table1 set snc...

Importing a table from Access into SQL and removing the carriage returns

I'm importing a table from Access that has an address field the address field contains carriage returns, these remain when I have imported them into SQL, can I run a SQL script to remove them? Any ideas much appreciated. Thanks ...

Bypass the need to add the prefix N in string literals

Hello, We inherited an application that was not originally designed to consume localized data (Localized strings like Russian/Japanese, Localized datetime formats, etc). The original developers who worked on the project did not anticipate that there will be unicode strings. Although the table's datatypes support unicode characters (NVA...

When would you ever set the increment value on a database identity field?

Given the table: CREATE TABLE Table1 ( UniqueID int IDENTITY(1,1) ...etc ) Now why would you ever set the increment to something other than 1? I can understand setting the initial seed value differently. For example if, say, you're creating one database table per month of data (e.g. Table1_082009, Table1_092009) and want to s...

How to modify multiple nodes using SQL XQuery in MS SQL 2005

In an table I have the following. ParameterID (int) ParameterValue (XML) ------------ -------------- 1 <USER><User ID="1" Name="Billy"/><USER> <USER><User ID="2" Name="Billy"/><USER> <MANAGER><User ID="1" Name="Billy"/><MANAGER> 2 <USER><User ID="1" Name="John"/><USER> ...

What does the ISPALUSER function call in the Msmerge_*_VIEW views do?

I'm trying to understand how SQL Server 2005 replication works, and I'm looking at the views titled Msmerge_[Publication]_[Table]_VIEW. These views seems to define the merge filters, and are pretty straight forward, except for one line of sql in the WHERE clause: AND ({fn ISPALUSER('1A381615-B57D-4915-BA4B-E16BF7A9AC58')} = 1) What do...

JSON Parse Error using Adobe Flex - PHP - SQL

I am trying to return results from my SQL database, using PHP to convert it into JSON, which is then read by Flex. Here is the parse error I receive - JSONParseError: Unexpected < encountered at com.adobe.serialization.json::JSONTokenizer/parseError()[/Users/mesh/src/as3corelib/src/com/adobe/serialization/json/JSONTokenizer.as:579] at ...