If I have this table:
+------+-------+---------------+--------+-----------------+------------+-----------+----------------+------+------+--------+------------+------------+
| type | class | username | userid | userip | usermobile | useremail | daysleft| pin1 | pin2 | pin3 | active | schoolname | schoolsite |
+------+------...
Suppose I have a table Books with columns Book_ID (Primary Key), ISBN (Unique), and several others such as Title/author/etc.
I have another table Sales, with primary key Sale_ID, a foreign key to link to Books, and other fields with info on Sales. Sales only exist for books with ISBNs. Is it better database design to have Book_ID or I...
I want to give access to certain data, in various databases on a single sql instance, to our parent company. They don't want a web service but instead want a stored procedure, which would compile data from different data sources and return a record set.
There is a trust between our two domains so essentially they are on our domain and I...
How can I execute a stored procedure using sqldatasource and get the return value in vb.net.
Thanks,
Terri
...
I have a routine one-to-many schema, similar to this simple example:
PERSON
person_id (PK)
PERSON_TRAIT
person_id (FK)
trait_id (FK)
quantity
TRAIT
trait_id (PK)
name
//other attributes
Given a set of traits ("friendly, funny"), how would I return the associated person_id and quantity recordset.
At first glance I was tempted to use ...
I'm getting the result with mixed dates values, instead get the last revision for each title i get them mixed.
I'm using MySQL.
The general idea is retireve all rows for each entry, the last revision of each entry.
My current sql query:
SELECT DISTINCT
w.owner_id,
w.date,
w.title,
MAX(w.revis...
I need a regex that will determine if a given SQL statement has a WHERE clause. My problem is that the passed SQL statements will most likely be complex, so I can not rely on just the existence of the word WHERE in the statement.
For example this should match
SELECT Contacts.ID
, CASE WHEN (Contacts.Firstname IS NULL) THEN ''
...
Hey guys, quick question. I have a table of messages.
There are two types of messages:
Messages with a unique group id
autonomous messages
Messages with the same group id as at least one other message - these I want to group together when they are presented. The grouped messages are messages with replies to them. What I want to do...
For example, if we are doing Analytics recording the page_type, item_id, date, pageviews, timeOnPage.
It seems that they are several ways to avoid it. Is there an automatic way?
create index on the fields that uniquely identify the record, for example [page_type, item_id, date] and make the index unique, so that when adding the sam...
I have the following tables:
Section and Content
And I want to relate them.
My current approach is the following table:
In which I would store
Section to Section
Section to Content
Content to Section
Content to Content
Now, while I clearly can do that by adding a pair of fields that indicate whether the source is a section or...
I have a following table
id group name
1 2 dodo
2 1 sdf
3 2 sd
4 3 dfs
5 3 fda
....
and i want to get intro record from each group like following
id group name
... 1 sdf
2 dodo
3 dfs
...
...
I need help. I don't know what the right way to create the table I need is. I can do it different ways, but I might be doing it a stupid way.
Here is an example of the situation I have.
I have persons.
Each person has fields.
Fields could be: ShirtType, PantType, HairColor, EyeColor, ShoeType, Height, Weight, etc.
I will need to add...
I've got stored procedures in my ASP code and I'd like to see the full command text (not just the (?,?,?,?) that will execute so I don't have to open up SQL Profiler.
Code is as follows:
sSQL="myProc"
Set dbCommand = Server.CreateObject("ADODB.Command")
Set dbCommand.ActiveConnection = oConn
dbCommand.CommandType = adCmdStored...
Hi,
I just can't get around my head about AUTO_CREATE_STATISTICS? I run the tuning advisor and it advised me to create statistics on a table. the AUTO_CREATE_STATISTICS is set to true and i would have expected the statistics would have been created automatically. Can anyone please explain?
...
Most(if not all) of the MVC frameworks provide an abstraction layer over the database and except in some very special cases you do not need to write SQL code by hand. Of course you need to know basic things to design your model but do we need deep knowledge how to optimize queries, make triggers and other db stuff.
...
SELECT
P.PK_PatientId
,PV.PK_PatientVisitId
--, PV.LastUpdated
, ISNULL(P.FName,'')+ ', '+ ISNULL(P.LName,'') AS NAME
, MAX(TVP.PK_VisitProcedureId) AS PK_VisitProcedureId
, MAX(PV.LastUpdated)AS DateSort
FROM
dbo.M_Patient AS P
...
I have a table containing a large number of rows. Each row has 2 columns which I need to use - the first is some HTML formatting and the second is the text. I need to concatenate all these rows into a single string value so that I can e-mail this massive string. Due to the large number of rows I can't use a VARCHAR variable - I have t...
I have report which calls parameterised SP. when i preview/debug/run the report i see three two box and one date control where i enter the values and view the report ,I can see the report correctlly.
My client asked me to put dropdown instead of text box.
Now I created two data set ,and changed parameter property to get values from quer...
ResultSet rs;
rs = this.orderedProduct.select(" sum(unitstoproduce) "," soNo = "+ soNo);
int sum = Integer.parseInt(rs.getString(1));
When i try to execute the above query inside the java class i'm getting an exception as below.
Here the orderedProduct(orderedZnAlProduct) is the table
SELECT sum(unitstoproduce) FROM or...
Inserting null into not null column with default is giving me a validation error instead of taking the default value.
I don't want to make on before triggers to all of the tables. Is there any other way to do this?
Firebird 2.1.3
...