I'm using sql-server 2005
Hi, i have Users table with userID and registrationDate. I want to select shortest period of time between two registrationDates when first date is x and other row is x+10 rows. I don't mind cursor because i will run this query once in a while.
I will explain again, i need shortest period of time between 10 us...
Hi,
Would like some advice from this. I got a table where I want to keep track of an object and a list of keys related to the object. Example:
OBJECTID ITEMTYPE ITEMKEY
-------- -------- -------
1 1 THE
1 1 BROWN
1 2 APPLE
1 3 ORANGE
2 2 W...
Hi,
I have a table which has only one number field: [ value NUMBER(12.0) ]
I would like to store these two types of non negative numbers.
Type A : ( a list of non negative numbers )
Type B : ( another list of non negative numbers )
I have just this one table. Without making any DML changes, is it possible for me to store both types ...
I have the following query for getting the latest comments:
global $wpdb;
$sql = "SELECT DISTINCT ID, post_title, post_password, comment_ID, comment_post_ID, comment_author, comment_date_gmt, comment_approved, comment_type,comment_author_url, SUBSTRING(comment_content,1,30) AS com_excerpt FROM $wpdb->comments LEFT OUTER JOIN $wpdb->po...
For a user content website I am creating, it has lots of sub-sections: Movies, Jobs, People, Photos, Mail, etc. It's like a yahoo portal but very very detailed with information search, like I a niching as deep as possible per topic unlike any site out there. I have the site being developed in codeignitor php and mysql. Search can be glob...
Hi.
Can anybody tell me how can I update a column of a record when it is inserted to the database.
Here's the pseudocode that I want.
if( mytable.OriginalId == null )
mytable.OriginalId = Scope_Identity();
...
I have two tables: messages (messages users posted), likes (many to many relationship between users and messages - it says that user1 likes message5).
messages
---------
id, id_user, message, created_at
likes
-----
id_user, id_message, created_at
If I send message, it goes to the messages table. If I like somebody's message, a new re...
i am facing null pointer exception in hibernate:
org.hibernate.dialect.function.CastFunction.render(CastFunction.java:11)
hibernate code is:
("Select date_format(str_to_date(form.dobDate,'%Y%m%d'),'%M (%Y)') as Month");
...
Hi, I am fresh to Codeigniter. I have a form which looks something like this.
<tr>
<td><input type="text" name="Name[0]" value=""></td>
<td><input type="text" name="Address[0]" value=""><br></td>
<td><input type="text" name="Age[0]" value=""></td>
<td><input type="text" name="Email[0]" value=""></td>
</tr>
<tr>
<td><input type="t...
Say tableA has 1 row to be returned but will have 100 columns returned while tableB has 100 rows to be returned but only one column from each. TableB has a foreign key for table A.
Will a left join of tableA to tableB return 100*100 cells of data while 2 separate queries return 100 + 100 cells of data or 50 times less data or is that a...
hello,
I wrote the following stored procedure, in which I use a local variable 'syncParam':
declare @syncParam bit
select isSync into syncParam from MyTable where id=@id
if (@syncParam='True')...
else ...
return @syncParam
When I executed this stored procedure at the first time it worked, but after that I get the following error:...
I want to add a row using SQLs INSERT statement. Is it possible that as part of this statement I can somehow get the value of the column userId which I don't update but is the AUTO_INCREMENT primary key. I need this value to update another table, however I can't follow the Insert statement immediately with a SELECT statement as there is ...
How can i find the Nth highest salary in the sql server
...
We have a database Ms
DBCC CHECKDB (MS)
Or
ALTER DATABASE MS SET SINGLE_USER
DBCC CHECKDB(MS,REPAIR_ALLOW_DATA_LOSS)
ALTER DATABASE MS SET MULTI_USER
Error message
Msg 0, Level 11, State 0, Line 0
A severe error occurred on the current command. The results, if any, should be discarded.
Msg 0, Level 20, State 0, Line 0
A severe er...
Hi,
I'd need a MySQL query to transform my nested sets structure into XML. (no PHP)
The Problem is how to close all tags correct.
My method of resolution:
1) Find leaves
2) Make a "TAG"-string (group_concat) and make it shorter with level
This is running:
A[01,16]
B[02,03] C[...
I do not clearly understand how to format the SqlDataAdapter for output variables when working with C#
Error Message:
Index (zero based) must be greater than or equal to zero and less than the size of the argument list.
Code Example (Stored Procedure works fine)
private DataTable updateOrdEodHold(DataTable tb, out string mn...
Hello
How do you list the names / fields of all the tables in a mysql database ?
Any code examples would be helpful,
Thanks!
...
How do I represent a subquery in relation algebra.
Do I put the new select under the previous select condition.
SELECT number
FROM collection
WHERE number = (SELECT anotherNumber FROM anotherStack);
...
Im using dbml (c# vs2010) to model my database and DataContext.CreateDatabase() to create it. Some time later I add a new property to one entity-type and now I want to upgrade the SQL-database to fit the new version of the dbml-schema. How do I accomplish this? Do I have to delete and re-create the database or upgrade it manually? Is ADO...
i have written code that takes data from text box and updates but as i have set in mdf file that ID will be auto incremented but this dose not happen.but if i enter data by right clicking "Show table data" in server explorer then there is auto increment
here goes code
public partial class Form1 : Form
{
System.Data.SqlClient.SqlConn...