all groups > sql server programming > june 2006 > threads for wednesday june 21
Filter by Day: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30
finding the closest exchange rate from another table based on the date
Posted by Rajeev at 6/21/2006 11:22:36 PM
Hi I have one table Expense_Amounts which contains HostAmt, Currenycd
columns and lockedDate.
We have another table called Exchange_Rates which contains Currencycd
and their exchangerate for last seven days (with Exchangeratedate
field).
Now i have to update the HostAmt in Expense_Amounts tab... more >>
can a SELECT return this result ?!
Posted by Bassam at 6/21/2006 11:03:26 PM
Hello, this is a table fragment - Table1
Voucher (Int) , RNo (Varchar(20) , Amount (int)
this is a data example
Voucher , RNo , Amount
----------------------------
1 , R1 , 100
2 , R1 , -100
3 , R1 , 100
4 , R1 , 50
5 , R1 , 25
6 , R2 , 30
7, R2 , 20
-----------------
now i need to ... more >>
can a SELECT return this result ?!
Posted by Bassam at 6/21/2006 11:01:00 PM
Hello, this is a table fragment - Table1
Voucher (Int) , RNo (Varchar(20) , Amount (int)
this is a data example
Voucher , RNo , Amount
----------------------------
1 , R1 , 100
2 , R1 , -100
3 , R1 , 100
4 , R1 , 50
5 , R1 , 25
6 , R2 , 30
7, R2 , 20
-----------------
now i need to ... more >>
Joining two SQL queries with different conditions
Posted by jsheldon via SQLMonster.com at 6/21/2006 6:15:40 PM
Ok I am stumped on this. i tried an inner join where posted_jrnl_line as a
and posted_jrnl_line as b, also tried subqueries where (select jrnlId [then
conditions]) to no avail...
I have two queries that execute perfectly. the two queries are retrieving
data from one table but the conditions ... more >>
Making an Access - SQL db solution portable
Posted by Martin Gregersen at 6/21/2006 4:50:57 PM
I have an Access application which runs in a server enviroment where I have
an SQL server that the Access connects to. The customer is so happy with my
soultion and told another company about it, they would like something like
that, so I need to make a copy of the setup to a cd to send to the ... more >>
Formatting a Select Statement
Posted by EESP at 6/21/2006 4:31:02 PM
Hi everyone!
I am looking for a function similar to the Left(), Right(), and
Replace() functions to insert characters into a returned list of my
date field. The date currently looks like this "06202006" the function
I am looking for would return "06/20/2006" something like this if
Insert() wa... more >>
Best Way To Aggregate a Large Table
Posted by Ctal at 6/21/2006 2:59:33 PM
I have a table that looks like this (simplified)
Account Period Amount
Assets 1 100
Assets 2 10
Assets 3 0
I want to create a new table to carry a balance for the amount column.
So that Period 1 = Period 1, Period 2 = Period 1... more >>
Issue with T-SQL and SQL 7 to SQL2000 conversion
Posted by Carl Imthurn at 6/21/2006 11:28:01 AM
I'm in the process of converting a database from SQL 7 to SQL 2000 and
have come up against a problem. The following code executes correctly in
the existing SQL7 database and runs to completion in about 1 minute.
In the 2000 database, it runs until I cancel execution -- I've let it
run up t... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Recursive/Tree Type Query in SQL 2000
Posted by McDale at 6/21/2006 11:05:02 AM
We are running on SQL 2000, and I am having problems trying to find the
"Best" way to perform this "recursive" function.
I have a transaction file, that allows for "raise" to a transaction $ amount
that we have staged into a table. With each new raise (minimum 0, max 4)
there is a new tran... more >>
Many-to-Many Variation
Posted by Smithers at 6/21/2006 10:37:49 AM
In establishing a many-to-many relationship between two tables, a 3rd
"junction" table is created that contains at least two foreign keys.
No problem.
But - what is a recommended way to proceed to create a many-to-many
relationship between (1) one table, and (2) two other tables.
For ex... more >>
auditting select statement
Posted by Tracey at 6/21/2006 10:21:02 AM
We have triggers written for insert/update/deletes of data, now there is a
new requirement to audit select statements ran against the database.
I know SQL Profiler shows the select statements ran. I was wondering if
anyone has suggestions on how to somehow use that function(or any other id... more >>
Unique Constraint on Table Variables
Posted by Amos Soma at 6/21/2006 10:10:46 AM
I know I can put a unique constraint on a Table variable. Is there any way I
can have the unique constraint ignore duplicates instead of throwing an
error on a duplicate?
Thanks,
Amos.
... more >>
Creating GUID for Identity key
Posted by dotnettester at 6/21/2006 9:34:43 AM
Hi,
Whats the shortest easiest way to create GUID to use as a Identity key in a
table?
Is there a function which I can use as a default value? (like getdate())....
Thnx... more >>
Date comparison logic in a trigger without hard-coding the year
Posted by FinnGirl at 6/21/2006 9:33:51 AM
I'm having trouble trying to figure out how to write logic into a trigger
that will find when a date in the Tax Due Date field, falls in a particular
quarter and was created after a set day of the year without hard-coding the
year information. I'm trying to avoid having to update the trigger.... more >>
many to many query with 1 row per result?
Posted by jwsolt NO[at]SPAM gmail.com at 6/21/2006 7:52:41 AM
I have three tables
Student
-ID
-FirstName
<etc.>
Test
-ID
-Date
<etc.>
StudentTests
- TestID
- ChildID
- Grade
What I want to do is have a query that returns a student's information,
with a list of tests they've had. So, one row per student would be
ideal. I thought ab... more >>
trigger/(exists) problem
Posted by tobinlim NO[at]SPAM gmail.com at 6/21/2006 7:36:07 AM
I created an insert trigger on a table that uses two columns as a key.
The trigger checks for an existing record with the same values for
those two columns and throws a user friendly error message. The
problem comes when I determine if a record with those values already
exist (e.g. -
if exists... more >>
Event Properties
Posted by sk.rasheedfarhan NO[at]SPAM gmail.com at 6/21/2006 6:31:17 AM
Hi All,
before you understand my problem see the http://www.eventid.net
the above URL is similar to my problem.
According to my project requirement I will give the EventID as input of
any Event. [Ex : MSSQLSERVER EventID is 17055].
So I have to retrieve all the standard properti... more >>
A tricky query
Posted by Dave Newman at 6/21/2006 6:00:05 AM
I have to write a query to generate a report over some interesting
data. It's basically scheduling which days people are working. The
data looks like this:
Employee StartDate EndDate Roster
---------------- ---------------- ---------------- ------------
Bob 12-Jun-06 ... more >>
Distinct and Unique
Posted by JP at 6/21/2006 5:35:02 AM
Hi
Distinct(in oracle and SQL server) and Unique(in oracle) are they both same
Can we use them interchangeably?
Thanks
JP... more >>
Quick Method to delete from Two Tables
Posted by Peter Newman at 6/21/2006 4:43:02 AM
I have two tables ( a & b ) Both are linked by a ledgerref field. table what
would be the quickest and easiest way to delete records from both when
a.textStatus = 1... more >>
how to model inheritance?
Posted by deja NO[at]SPAM 2bytes.co.uk at 6/21/2006 4:22:16 AM
I have a table which I have previously used for objects of a certain
class i.e.
book
this table has a number of columns representing the properties of the
book i.e number of pages, author etc.
I want to be able to record an inherited object so for example I will
have Book1_v1 and Book1_v... more >>
Can one exec a stored procedure in a case statement in a stored procedure?
Posted by Colette Horter at 6/21/2006 3:37:25 AM
Hi there,
Trying to do a complex query and pulling my hair out!!!!
Can one execute a stored procedure and get a value back from it in a
case statement in a stored procedure? as in:
create procedure ...........
..............
.............
...............
select field1,
field2,
... more >>
proc execution time in management studio vs query analyzer
Posted by Quinn at 6/21/2006 2:32:41 AM
One of the developers on my team wrote a stored procedure that returns over
10 resultsets. Running this procedure in SQL 2005 management studio takes
over 800ms while the same procedure run on the same server takes a little
over 100ms in query analyzer. Does anybody know why there is such a bi... more >>
Traversing a tree hierachy backwards
Posted by Robert Bravery at 6/21/2006 12:00:00 AM
HI all,
I need to be able to traverse or find the all relevant parent nodes of a
tree given a particular node. Im using the adjacency model with stored path.
So if I know a certain employees number, I need to list all their superiors
back to the top of the tree.
I have a table structure simil... more >>
Joining table to itself
Posted by Morten Snedker at 6/21/2006 12:00:00 AM
In myTable I have
RequiredAmount
RequiredDate
GrantedAmount
GrantedDate
I wish to obtain one view showing the sum per year.
For the required part it would be:
SELECT YEAR(RequiredDate) AS myYear, SUM(RequiredAmount) AS reqAmount
FROM myTable
GROUP BY YEAR(RequiredDate)
And for ... more >>
SQL 2005: How to list all Stored Procedure like sp_tables
Posted by Andreas Klemt at 6/21/2006 12:00:00 AM
Hello,
how can I list all Stored Procedure like sp_tables?
Are there other or new ways to get the Stored Procedure code like
sp_helptext in SQL 2005?
Thanks for helping me.
Regards,
Andreas Klemt
... more >>
how create linked server to informix
Posted by Tarvirdi at 6/21/2006 12:00:00 AM
I want to create a linked server to Informix through OLEDB.
I tried to use sp_addlinkedserver but confused with wanted parameters
name!!!
Bellow settings are my odbc connection that can help you to advise me ,how
to setup parameter to values
working odbc
Servername=bronz
Host Name=192.168... more >>
Database in use ??
Posted by Pete Moscatt at 6/21/2006 12:00:00 AM
I am using Visual Studio C++ 2005 to connect with a SQL Server 2005
database.
When creating the connection then do what needs t be done I close the
connection as can be seen in the code below.
When I create another instance of a connection and update data within
the database I receive an ex... more >>
|