sql

Oracle: SQL query that returns rows with only numeric values

I have a field (column in Oracle) called X that has values like "a1b2c3", "abc", "1ab", "123", "156" how do I write an sql query that returns me only the X that hold pure numerical values = no letters? from the example above would be „123“ and „156“ select X from myTable where ...?? ...

LINQ to SQL: Many to many with Multiple primary keys?

Ok this is something a bit simple but as I'm new to Linq and to SQL overall I guess I need a little help. Most tutorials assumed some sql knowledge and therefor weren't as helpful and also hard to search as I do not know this join name ( Inner left? ). Situation: TableParent with 2 primaryKeys, ParentKey1 and ParentKey2 TableChild with...

Split Multiply Arrays Loop Trough Records and Insert Records in SQL server 2008

Hi I am trying to split multiple arrays and insert them into SQL Server. From my query string I receive the following Sport.aspx?ReaderID=A1B5A0F5C4E4A1B5A0F5C4E4&DataID=11B6C56A90B645B6C56A90B6,10 Oct 2010 13:15:20,|22B6C56A90B645B6C56A90B6,10 Oct 2010 14:15:26,|&Msg=04 What I need to do is split the pipe delimited field into MyTagI...

How to copy a table from one mysql database to another mysql database

Hi, I need to copy a table from one database to another. This will be a cronjob. Which one is the best way to do it? PHP script or Shell Script. The problem with PHP, both databases has different usernames and passwords so I can't do it like this. CREATE TABLE db1.table1 SELECT * FROM db2.table1 Should I just connect first DB get all r...

How to place negative value into brackets

i want to place negative value in bracket like -2000 to (2000) for that i made a which is converting -1361236.75886298 to (1.36124e+006) the function that i made for this is : ALTER function [dbo].[IsNegative]( @Number NVARCHAR (500) ) Returns nvarchar (200) as begin Declare @Number2 FLOAT set @Number2=Cast (@Number as float) Declar...

How to export query results to csv in Microsoft SQL Server Management Studio?

Hi, Trying to export custom query to csv file I wrote the following command: sqlcmd [-S myserver -d mydb -E -Q "SELECT column1 ,column_date, DATENAME(WEEKDAY, column_date) AS day_of_week ,distinc_events_count ,total_events_count ,event_duration FROM dbo.event_daily_stats ORDER BY column1" -o "D:\MyData.csv" -h-1 -s"," -w 700] but it ...

SQLServer join two tables

Hi guys, I've gotta question for you, I'm getting hard times trying to combine two tables, I can't manage to find the correct query. I have two tables: T1: 1column, Has X records T2: 1column, Has Y records Note: Y could never be greater than X but it often lesser than this one I want to join those tables in order to have a table with t...

Download an English dictionary

Hello, I wondered if anyone could point me in the direction of a English dictionary download (free). I do NOT want: Spelling check dictionaries Links to websites that don't provide me with an actual dictionary Dictionaries in some weird format I want something like a notepad or SQL script that has the following simple format: Hat...

PostgreSql + Typecast of Boolean into Character Type

Here, I am unable to convert boolean value into character in postgre sql query. SELECT *FROM ltl_class_nmfc_aliases WHERE ltl_class_nmfc_aliases.id NOT IN(SELECT ltl_class_nmfc_aliases_id FROM commodities_shippeds WHERE commodities_shipped_obj_type LIKE 'ClientOffice') OR ltl_class_id IS NULL AND lower(commodity_description_alias) ...

SQL Server 2005: how to subtract 6 month

I have a date, suppose today date declare @d datetime set @d = '20101014' I need select @d - <six month> where is the real number of days that contains last six month, beginning from @d. ...

How to update data model class after manually changing .dbml file

Hello. Does anyone know how could I get the data model class updated after I make some custom changes in the .dbml file. I tried to manually mark some fields nullable in the .dbml, but changes are not visible in the code, no matter how many times I rebuild. I even tried to edit .dbml(xml) in an external tool, and then save, but no use....

Maven SQL plugin execution order

I am facing some problem in ordering the sql execution. We have one sql script file for each table under one directory. Ex: There is user.sql and role.sql in the directory c:\SqlScripts. We are using the sql maven plugin to execute these sql files. The role table has a Foriegn key to the user table and the execution is failing because...

Avoiding duplicate identifiers in the database

NOTICE: Appericiate all the answers, thanks but we already have a sequence.. and can't use the UNIQUE contraints because some items need to have duplicates.. I need to handle this using PLSQL somehow, so based on some criteria (using an if statement) i need to ensure there is no duplicates for that.. And just to confirm, these identifier...

sql query structure

Hi, I have the task of cleaning up some of our data in SQL Server 2008 for CS2009. In our profiles database there are two tables: Addresses UserObject Address: address_id, line1, line2 guid, varchar, varchar UserObject: userid_id, addressguids, acitivtydate guid, varchar, datetime I need to remove all UserO...

Pattern Matching in SQL Issue -- Finding the Right Query with PHP

Hello all. I'm in need of some quick help on matching a field in my database that stores all of the "parent" categories for my online store. Here's an example of how my "parents" are stored in the table via one field named Parent: MENS MENS-BRANDS MENS-SHIRTS MENS-T-SHIRTS Here is my query in PHP to perform the call: $query = "SELEC...

Why did this trigger change speed my query up?

Hi, I've been trying to solve a slow trigger problem and now that I have through trial and error, I still don't know what the original problem was. The query I'm running is the following: UPDATE tblA SET X = NULL WHERE X IS NOT NULL AND Z = 0 It updates around 30k rows. And the part of the AFTER INSERT, UPDATE trigger on tblA caus...

Help in getting a database management system running.

http://projectabstracts.com/406/java-based-online-shopping.html This project is about "Online Shopping". It uses Java as front-end implementing applets, servlets and JDBC as the connecting link to the back-end which is implemented using SQL. The problem is that I'm a newbie in all this stuff and I don't understand how to get this projec...

T-SQL query help - select unique grouping?

My table has 3 columns: RecordId Value InsertDate Each RecordId has multiple entries in the table. In fact the table gets updated several times a day. How do I write a t-sql query to select all the latest rows (based on InsertDate) for each unique record? My t-sql skills are non-existent. Thanks in advance ...

SQL Group problem

I have this query which is showing the ORA-00979:not a GROUP BY expression error. I'm not a sql pro so please could you give me a hint what's wrong ? SELECT * FROM (SELECT a.*, ROWNUM r___ FROM (SELECT DISTINCT "SMTAPP"."XF_MASTER"."ID" AS "XfMasterEntityId", "SMTAPP"."XP_MASTER_DETAIL"."WIFE...

Delete all posts in a table exept the one where big_image has a value?

Hi I want to delete all posts in a table exept the one where big_image has a value? I have tryed allmost everything but its not working! This is tha last one: sql3="delete from links where userId="& session("user_id") &" and big_image NOT IN (select big_image from links where userId = "& session("user_id") &" and big_image="& bgbild...