My SQL query SUMs up sales transactions by day by revenue center by customer type (3 types).
It results a queryset with 3 rows - 1 for each of 3 member types -- date / revenue center ID / da...
I have a data base that has some single quotes in the field EX: new''car. I want to query the data base to locate (and replace) these single quotes but for the life of me can't remember how to...
Hello all!
I have a Stored Procedure that I use to generate a dataset that is subsequently used in a Crystal Report.
In order to track the data that is being processed, I'd like to generat...
This is my sql so far
declare @timestamp datetime
declare @dt varchar(20)
set @timestamp = '03-29-08 03:10:09'
select @dt = (datepart(@timestamp,yyyy))+'-'+(datepart(@timestamp,mm))+'-'+...
Hi
I have a MS Access database table with a DateTime field in it. The following INSERT statement works:
INSERT INTO Table VALUES(...., '4/26/2007 5:25:59 PM', ....)
but the SELECT state...
Greetings,
In a SQL Server database, can you create multiple foreign keys on a table and all the column involved have some null values? If the table already has a primary key and you need t...
I'm a little new to running queries via Excel and am getting the above error but can't figure out why. I'm trying to run an Access query via Excel VBA, the query runs ok in Access.
Thanks ...
Hi there
I'm trying to update a field in one table from another table in a different db, this is what i tried and it comes back saying 500+ ropws successfull but nothign has changed. Can so...
I am trying to format a datediff in a paticular format. I have a start date and end date and I am using datediff("D",startdate, enddate) which return only a number of days which is what it was...
MS SQL 2005
This is a function within a stored procefure
SET @FunctionText = N'SELECT @Achieved = ' + @Function + N'("' + cast(@Customer_ID as varchar(5)) + N'", "' + cast(@date as...
I have a table. It's a big table. It has lots and lots of columns (about 150).
I'm copying a row from this table to table B. Then I'm updating a column or two and copying it back into the ...
Dear experts,
i have 2 sybase databases.
1 used for production and 1 use for development.
all my tables have an autonumber primary key.
recently, i've taken a project of upgrading the so...
Hi,
I am new to Procedures and cursors, so would appreciate some advice on this.
In the following Procedure, the Select of the Cursor can return one or more rows.
CREATE OR REPLACE PR...
I have a table that looks like this:
CarID CarName CarColor
------- ----------- -----------
car10 Infany Blue
car11 ja...
Hi There
I would like to work out how many days there are for a particular date up until now.
I have a query that looks like this.
UPDATE TBL_FEESDATA
SET TBL_FEESDATA.RealDaysOs = DateDi...
I've used this method in sql to convert null value to empty string but I'm looking for a hand in how to do the same with MS Access select query:
sql syntax:
select IsNull(Terms,'') As Te...
Here is the basic idea of what I am trying to do. I need to copy data from one column to another column in the same table if a condition is met in another table.
Update tbl1
Set tbl1...
I need a simple sql that will update a missing date field from the single record (per call id) Call Header to the multiple record (per call id) Call Detail table.
I've been trying:
UPDATE ...
Working with MS SQL server 2000. Please be very explicit in your responses.
Output I need is a list of tickets generated during any of the options below.
Current week
Last week
Current Mo...
I am trying to familiarize myself with materialized views. I want to use them for a data warehousing scenario, so only really need them to refresh once a day. However, I have been experimenti...
We have a jobs table. On insert of any data, we want the data copied to the similar table in a different database in the same server. what is the syntax for writing insert trigger?
I am trying to do a query with an if statement in the where clause, but I am getting a lot of errors I can't resolve.
Here is what I am trying to do:
SELECT * FROM table1 AS t1 INNER JOIN...
I have a query similar to the one shown below on a system with Oracle 10. As written, it is an inner join. However, I would like to modify it to become a left outer join. If the only join ...
I have the attached SQL query which taking hours to run. It badly needs optimising but I'm no SQL expert!
Any help greatly appreciated!
I think it's the like bit which is slowing the query...
I have the attached and SP code snippet which, when fed a VCHRNMBR variable, will return up to 4 rows. I need to design a WHILE Loop to combine the DistRef field from all the returned records...