Sorry for the long post, but most of it is code spelling out my scenario:
I'm trying to execute a dynamic query (hopefully through a stored proceedure) to retrieve results based on a variable number of inputs.
If I had a table:
(dbo).(People)
ID Name Age
1 Joe 28
2 Bob 32
3 Alan 26
4 Joe 27
I want to allo...
I am trying to set a foreign key relationship between an Order_Items table and Parts table. I want to link the parts to products in the Order_Items table via foreign key. I have no issues doing this with other tables.
Here is how the Order_Items table is defined:
CREATE TABLE [dbo].[Order_Items](
[order_id] [uniqueidentifier] NOT N...
I am trying to populate a date table which contains every date for the next 35 years with information regarding each day.
My ERP system has an accounting years table (GLRULE) which specifies the accounting periods for each specific year since many companies do not work on Calendar Months.
The GLRule table contains one record for each...
Can someone recommend a great IDE/Database Developer Tool for Postgres 8.4. We are currently using EMS SQL Manager but it has so many bugs and shortcomings that its getting on my nerves. I reported the bugs to EMS but they have not been fixed yet.
I wonder what do people use for PostgresSQL development? Windows/Linux, commercial/free, ...
This is more of a curiosity at the moment, but let's picture an environment where I bill on a staunch nickle&dime basis. I have many operations that my system does and they're all billable. All these operations are recorded across various tables (these tables need to be separate because they record very different kinds of information)....
I have the following code:
Dim dbHousing As New dcHousingDataContext
Dim pullresidents = From p In dbHousing.webResidents _
Select p.dorm_building, p.dorm_room, p.occupantnum _
Order By dorm_building, dorm_room
Dim j as integer = 1
Dim previous As String = ""
For Each row In pullre...
I have the following query:
var data = from d in dc.GAMEs
where (d.GAMEDATE + d.GAMETIME.Value.TimeOfDay) >= DateTime.Now select d;
This generates some horendous looking SQL, looking something like this:
SELECT {...} WHERE DATEADD(ms, ((CONVERT(BigInt,((CONVERT(BigInt,DATEPART(HOUR, [t0].[GAMETIME]))) * 36000000000) + ((CONVERT...
Hi im trying to use Sql within MySql to sort some values and this is what I have:
Select from my table the rows where the value in column status equals online and the value in column tags equals museum, order them by name and in ascending order.
SELECT *
FROM tech
WHERE `STATUS` = 'online'
AND `TAGS` = 'museum'
ORDER BY NAME ASC
...
I have a request to create a web application on a a public web site that would display data from about 5 tables in mySQL. I would like to display parent/child relationships.
Is there a product that I could use to generate code to do this? I was thinking PHP would be good to use.
...
Hello,
I have a simple SQL question. I want to make a 3 column database and I have the following code:
sqlite3 meshdb.db "create table t1 (t1key INTEGER PRIMARY KEY, prideID, pubmedID);"
When I try to import a simple csv file with two columns (prideID and pubmedID), I get a "expected 3 columns of data but found 2" error. I want the t...
Hey all
how to combine 2 different tables where they contain the same fields but different data, example
Cash_Expenses
{
exp_date
exp_cat_id
exp_amount
exp_remark
}
Cheque_Espenses
{
exp_date
exp_cat_id
exp_cheque_NO
exp_amount
exp_remark
}
exp_cat
{
cat_id
Cat_name
}
now what i am trying to do is that i want to combine those t...
I am trying to connect to a database on my local server. The database is called "dbtest." Of course, I have left off my actual password and replaced it with "password."
This is the typical code I see on every tutorial, but it doesn't work at all. Please help.
<%
Dim con, rs
con = Server.CreateObject("ADODB.Connection") 'I thin...
This is basically an extension of Update multiple rows with one query?. I want to be able to update multiple columns of multiple rows at a time, but not necessarily to update every column of every row.
Here is an example command I would like to be able to execute:
UPDATE person
SET name = CASE id
WHEN 1 THEN 'Jim'
WHEN 3 THEN ...
Hi,
I am reading through a plethora of articles at the moment to try to assist me.. just seems so many options and cannot seem to find a clean solution.. it probably is very basic so apologies in advance!
So I have an XML field in SQL 2008. It basically contains something like:
<root><id>1</id><id>4</id></root> and so on...
What I ...
I have a Sqlite notes database with a "Toxi" schema (Notes table, Tags table, Note-has-Tag table called "fkeys"). There is another thread that goes into this, and the querying of it, it great detail. The interface or "front end" is a Tcl script run from Tclsh. The Tcl version works just fine if I just have 1 arg and no INTERSECT. In Sqli...
Hello I am new in creating stored procedure can you help me how to do this.
Error:
Incorrect syntax near the keyword 'AS'.
Must declare scalar variable @Serial.
CREATE PROCEDURE sp_SIU
-- Add the parameters for the stored procedure here
@Serial varchar(50),
@Part varchar(50),
@Status varchar(50),
AS
-- SET NOCOUNT ON...
This should be simple Im just not getting the desired result, i've tries this a couple of ways and still not getting anywhere I need to get the total cound of records of the subquery I know this is totally wrong but when but when I put the count on the subquery it still gives me 1 here's my code:
SELECT COUNT(*) [COUNT]
(
S...
Hi All,
I have a case of updating the target table where source columns data not equal to target columns data. I am trying to do this in data flow OLE DB command component but not supporting multiple usage of the columns. I don't want to use the MERGE statement due to the database hits in this business logic.
UPDATE targettable
set co...
I have managed to insert the whole text-file data in SQL-SERVER database table with this statement
BULK INSERT [dbo].[tablename] FROM 'c:\weblog.log' WITH (
FIELDTERMINATOR = ' ',
ROWTERMINATOR = '\n' )
But my text-file is not organized in any format and it contains some data i want to omit from the insertion process. So i am looking ...
In Access Sql 1 or 2 returns -1 the value for true. How can i get it to return 3 which is the numeric orring (?) of the values. This works in Sql Server
select 1 | 2
returns 3
...