sql

Syntax Checker and Validator for SQL?

Is there something like lint (syntax checker and validator) for SQL? ...

SQL Server Login

What is the SQL query to check whether particular SQL Login is Enable or Disable? ...

Oracle Schema upgrade with new constraint- how can I reduce upgrade down time ?

I have a oracle repository up and running and has say 10 million records. One of the table is say CREATE TABLE TABLE_A NAME VARCHAR2(128), VER VARCHAR2(128), TYPE VARCHAR2(32), DESCRIPTION VARCHAR2(256), CONSTRAINT TABLE_A_PK PRIMARY KEY ("NAME","VERSION"); This table is being used for long and now say I have a requirement to change...

Specifying properties to be updated in linq query

Hi all. I want to be able to specify the properties to get populated/updated in the linq expression. Something in the following fashion: Proxy.UpdateEmployee(List<string> propertiesNames) Proxy.GetEmployee() //inside the method populate only certain properties The return values must be of known type(no anonymous types accepted). DLINQ...

sql query help - how to properly join ??

Hi guys, Let's say if I have a table "PersonData" in which 4 of its columns are FromPersonId, FromEmployeeId, ToPersonId, ToEmployeeId Any of the records only ever contains Only one From** and Only one To** and the other two columns are null. Also FromPersonId and ToPersonId belong to "Person" table and FromEmployeeId and ToEmployeeId...

comparing a column with itself in WHERE clause of oracle SELECT

Hi, I have a multi-table SELECT query which compares column values with itself like below: SELECT * FROM table1 t1,table2 t2 WHERE t1.col1=t2.col1 --Different tables,So OK. AND t1.col1=t1.col1 --Same tables?? AND t2.col1=t2.col1 --Same tables?? This seems redundant to me. My query is, Will removing them ha...

SQLite and hierarchy in one request, how to do so?

Facts I have a pretty simple table: ID, name, PARENT_ID I would like to retrieve the hierarchy from down to top in one query using SQLite. Question : How can I do that ? Is there any request that will let me do that in One request? I´ve read about the 'Modified Preorder Tree Traversal', it is straight forward to get the hierarchy ...

How to display two columns in a join query that map to same column in second table

I have a table T1 with the following columns T1 ---------- ID | Name ---------- 1 Sender1 2 Receiver1 3 Receiver2 4 Sender2 Table T2 T1 --------------------- SenderID | ReceiverID --------------------- 1 2 1 3 4 2 I want to join the two tables in such a way that i want to get the sender and th...

SQL Converting string MMM.YY to date

Hi, how do i convert/cast a column contains strings e.g. Jan.08,Feb.08.. into date format so that i can sort them? Greatest Thanks! ...

SQL query for selecting only first occurrences of rows with same data in the first column

Is there a neat SQL query that would return rows so that only first occurrences of rows, that have same data in the first column, would be returned? That is, if I have rows like blah something blah somethingelse foo blah bar blah foo hello the query should give me the first, third and fourth rows (because first row is the first occurr...

Table partitioning in SQL 2008 - Why?

I understand how it works, but the book I'm studying doesn't tell me why you'd want to partition. Could someone shed some light? I can't understand any concept unless I see how it's useful. ...

Finding continuous ranges in a set of numbers

I have a reasonably large set of phone numbers (approximately 2 million) in a database table. These numbers have been inserted in blocks, so there are many continuous ranges of numbers, anything from 10 numbers to 10 thousand in a range. Some of these numbers are in use and are therefore marked as unavailable, the rest are available. Giv...

How to sum between dates using SQL?

Look at the following UPDATED scenario (sorry that I fooled you with the un updated version - hope it will be clearer now) - it may seem simple to some people, and hopefully it is! Explanation: Every row is a Request. Allocated is the number of people requested to an activity, total is the total amount of people for this country availab...

Help with a SQL Query

My tables: suggestions: suggestion_id|title|description|user_id|status|created_time suggestion_comments: scomment_id|text|user_id|suggestion_id suggestion_votes: user_id|suggestion_id|value Where value is the number of points assigned to a vote. I'd like to be able to SELECT: suggestion_id, title, the number of comments and the SUM...

schema in Oracle

I want to know is there any software design the schema of oracle database?I mean if you work with Microsoft Sql U can easily design your database ,see the relation ,all tables and their fields,I want to know is there any software do same work in oracle. I already try to find it in oracle Developer but nothing found! ...

Is it possbile to update data inside a CLOB using SQL ?

I have a table having one clob column which has XML data in it. say i want to replace XYZ with ABC in clob column. Is it possible using sqlplus? ...

MySQL export indices

I'm sure it must have been asked before, but I can't find it: I have a CMS that is under constant development. I have built a number of websites using the CMS, so their are a number of databases in existence. I want to extract the indices from the development db and apply them to the production dbs. Is there an easy way to extract indi...

Wordpress & SQL: Adding a custom field to all posts

I need a SQL query that I can run in PHPmyadmin that adds a custom field (with a value) to all existing posts. Can anyone help? Is this even possible? ...

Loop through controls and change LINQ columns

Hi I have the following code: Dim i As Integer For i = 1 To 20 Dim captionTextBox As TextBox = DirectCast(Me.FindControl("news_Image" + i.ToString() + "CaptionTextBox"), TextBox) Dim deleteCheckBox As CheckBox = DirectCast(Me.FindControl("Image" + i.ToString() + "DeleteCheckBox"), CheckBox) If Not deleteChec...

Log file size is huge

Hi, We have one database and we do lot many transactios per day, so the log file size growing too much, and i have tried shrinking it but its not reducing.. What shall i do to reduce the log file size. (We do too many inserts) Thanks Srinivas ...