|
Newbie: Help writing a sproc
I have a table b Testb with two columns, a datetime column called b Last_Usedb
and an int column of user IDb s called b User_IDb . I want to write a sproc
that gets the max Last_Used datetime of each user ID and if the max datetime
for a user ID is less than the current time minus one hour then all ...
Fri, 14 Jan 2005 06:49:01 -0800
|
Removing the Default of a column
>> Hope anyone can help me figure out how to write a proc to insert a
subtree under a parent and I can choose to insert next to or before a
node. <<
The "@is_left BIT" parameter makes no sense to me and you never use it.
It is also a bad idea to use BIT datatypes at all.
The usual method is to add new subtr ...
Fri, 14 Jan 2005 16:41:44 +0200
|
handling special characters
This example shows how to read the return code as wll as multiple output
values:
use pubs
go
create proc foo
@title_id varchar(20),
@pub_id varchar(10) OUTPUT,
@price money OUTPUT
AS
SELECT @pub_id = pub_id, @price = price FROM titles WHERE title_id =
@title_id
RETURN (0)
GO
DECLARE @pub_id var ...
Fri, 14 Jan 2005 06:11:02 -0800
|
Truncating a Date
Hi guys....
In Oracle, I would use the Function TRUNC(Sysdate) to truncate the current
date. In SQL Server, I am currently using this:
Convert(DateTime, Floor(Convert(Numeric(38, 5), GetDate())))
Is there a better way?
Thanks,
Forch ...
Fri, 14 Jan 2005 06:03:04 -0800
|
Return multiple values from a stored procedure
I have a couple of stored procedures and they need to both accept multiple
values and return multiple values.
Accepting multiple values is fine I know how to do that.
Returning multiple values is the question. I want to return a key value
from a table and an error code (either set to -1 or @@error).
Any ...
Fri, 14 Jan 2005 05:49:01 -0800
|
Getting at the parameters of a stored proc?
Is there a metadata table which can be queried to get at the
parameters of a stored proc?
--
Galen Boyer ...
Fri, 14 Jan 2005 08:31:46 -0500
|
timeout while moving large number of rows
I am reposting because I had a misspell in the previous post.
I have a transactions table that has an intensive use all day (24 hours)
For better performance at 5 AM, I move all transactions of previous day from
the production table to a history table.
The problem is that while moving (2 minutes aprox) ...
Fri, 14 Jan 2005 09:47:47 -0400
|
Using a select statement to only insert into particular rows
Hey,
I am not sure how to really explain this, but I'll give it a try.
I am looking to use a select statement in a way that I can tell it which
rows to insert in depending on when only one result is returned. For
example, if I run this statement:
SELECT Column1, Column2, Column3
FROM #Temp1
The re ...
Fri, 14 Jan 2005 04:49:08 -0800
|
VBScript within DTS package Hanging
Hi
I saw mention somewhere in this group that although you can have two fields
in a single table that are both FK to the same PK in a parent table, that you
are not able to have both with cascaded updates..
Okay, this seems problematic - I think I would like both fields to change if
the PK is changed in the ...
14 Jan 2005 03:34:42 -0800
|
Multiple FK in single table with cascaded updates
Hi
I saw mention somewhere in this group that although you can have two fields
in a single table that are both FK to the same PK in a parent table, that you
are not able to have both with cascaded updates..
Okay, this seems problematic - I think I would like both fields to change if
the PK is changed in the ...
Fri, 14 Jan 2005 03:33:02 -0800
|
Insertion problem in a multi server environment
HI,
I am using a procedure that inserts data from a database to another. This
insert is divided into many parts because of the large amount of data.
When the two databases are on the same server, all data are correctly
inserted.
When the two databases are located on different servers, only a part of my
d ...
Fri, 14 Jan 2005 03:27:01 -0800
|
More details about Error Msg=8124
Hi,
Want to know more details about SQL Server Error Msg 8124,
"Multiple columns are specified in an aggregated expression containing an
outer reference. If an expression being aggregated contains an outer
reference, then that outer reference must be the only column referenced in
the expression."
What ...
Fri, 14 Jan 2005 16:51:07 +0530
|
reverse a string
Is there a way that I can reverse a string, so that 'peter' is returned as
'retep' ?
- Craig ...
Fri, 14 Jan 2005 03:09:02 -0800
|
Which one is better WriteText or UPDATE
Hi,
I am facing a problem. i am having one text field, and i need to update it.
I can use both Update and WriteText statements if i pass the new value as an
argument. But wants to know which one is better
Aneesh
...
Fri, 14 Jan 2005 16:07:35 +0530
|
A query where two tables are linked to the same another table
On Fri, 14 Jan 2005 07:57:56 +0100, SLE wrote:
(snip)
> What I need is to
>enforce a single-column reference from Items to a Caption (i.e. caption_nbr)
>and have uniqueness (PK) of caption_nbr with the language_code in Captions.
Hi SLE,
A foreign key can only reference a column (or combination of columns ...
Fri, 14 Jan 2005 10:26:16 +0100
|