all groups > sql server programming > december 2003 > threads for wednesday december 31
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 31
How To make a REFERENCING to Old value or New Value in a Triggers
Posted by JANE at 12/31/2003 7:05:10 PM
Dear All:
I can reference old value and new value in a trigger using Oracle as
belews:
CREATE OR REPLACE TRIGGER trigger_1
AFTER INSERT OR UPDATE
ON table1
REFERENCING NEW AS n OLD AS o
FOR EACH ROW
WHEN (n.organization_id IN (82, 83))
DECLARE
v_neworgzid VARCHA... more >>
Need help with DATE code
Posted by George Morton at 12/31/2003 6:39:47 PM
I want to create an 8 char string for today's date in the format 'YYYYMMDD'
using T-SQL <not VB>.
Also, is there functionality like DATEADD in VB for TSQL. How might you get
a date three days from now?
TIA and Happy New Year. George.
... more >>
Transactions
Posted by Brandon Owensby at 12/31/2003 3:49:50 PM
I have a process that can potentiall affect alot of records. I was testing
this out and it seems that when I let it go on a large number of records it
takes along time. The time it takes seem to start of linear until you get
to a point and then it becomes an exponential increase in time. I was... more >>
Search through coma delimited lists
Posted by books1999 NO[at]SPAM hotmail.com at 12/31/2003 3:05:17 PM
hi all,
I have two columns ProductType text and and Countries varchar 250
(both types can still be changed).
The columns contain similar structure of data: strings of coma
delimited lists for example: 12,13,14,15,53,77,87,98
I would like to find all rows where ProductType contains the num... more >>
Replace Function
Posted by Gregory at 12/31/2003 2:51:05 PM
Hi
Is it possible to perform two Replacements in the same statement? For example
I have a value c:\test.do
I want to replace 'c:\' with '' where 'c:\' and replace '.doc' with '' where '.doc' exists.
The directory name and file extension may or may not be part of the column contents for any... more >>
sp_updatestats slowing queries
Posted by Kevin3NF at 12/31/2003 2:39:44 PM
Has anyone experienced sp_updatestats drastically slowing down complex =
queries that create a large Dynamic SQL? =20
If I rebuild the indexes on the table, this query returns in 2 seconds. =
If sp_updatestats is run, the same query, same parameters, etc. takes =
between 17 and 27 minutes.
... more >>
select statement with no order by
Posted by Eric Sabine at 12/31/2003 1:29:35 PM
A table with a primary key on a datetime column does not order the resultset
when I perform the following query.
SELECT pkColumn FROM myTable WHERE otherColumn = '123'
Here is the 27 row resultset as shown in query analyzer. While I did not
sepecify an ORDER BY, I have assumed that the exis... more >>
slow query -- help much appreciated
Posted by matthew c. harad at 12/31/2003 1:11:34 PM
i am working with the following table
create table stockTick(
tickID int identity(1,1),
securityID int,
timestmp datetime,
price money,
volume int
)
this table stores intraday price and volume data for
common stocks. there are 11 million rows in this table.
th... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Problem with CONVERT datetime in SP from ADO - not in Query Analyzer
Posted by Juan Miguel Venturello at 12/31/2003 1:08:42 PM
First, happy new years to all :)
Got a problem with a SP. I have been researching this issue most of the day
but have found no answer yet.
My application is calling a stored procedure through ADO. It is done in C++
and the call of the SP happens inside a COM object called from the GUI. The
... more >>
Schedule job
Posted by Fred Esmaeili at 12/31/2003 11:39:47 AM
All,
I have a VB 6.0 process scheduled on SQL server 2000. It
does not pop up the program Window. What's missing?
Thanks,
Fred Esmaeili... more >>
SQL Query Question
Posted by news at 12/31/2003 11:07:44 AM
I think this is a relatively easy question:
I have a table that contains duplicate records. I confirmed this by running
query:
select recid, count(*)
from table
group by recid
I'd like to remove the duplicate records and leave the original using an SQL
query but I
don't know how to app... more >>
What is wrong in this function
Posted by simon at 12/31/2003 9:30:22 AM
I have function which returns the first free start time and first free end
time in limits, you enter. It works OK just in this case it returns:
start_date='2003-11-24 09:41:00.000' and end_date='2003-11-24 09:41:00.000'
what is wrong, it should be:
start_date='2003-11-24 11:55:00.000' and end_da... more >>
Stored procedure not returning error
Posted by danwager NO[at]SPAM yahoo.com at 12/31/2003 9:25:54 AM
I have a stored procedure (SP1) that is erroring out, but not
returning the error. SP1 calls SP2 inside itself and in that one it
calls SP3. I purposfully put in SP2 an error to try to trap it in
SP1. Well I have included the code after SP2 is called:
IF @@ERROR <> 0
RAISERROR('Test Er... more >>
Stored Procedure Help
Posted by Rob Meade at 12/31/2003 9:14:57 AM
Hi all,
I have been given the task of writing a notification application. I work in
one of the primary care trusts in the NHS (UK), the current process for
notifying staff of urgent matters is to spam all staff in the trust (2500)
with an email - obviously a LOT of people receive these that d... more >>
ALTER TABLE on temp tables, table variables
Posted by Etienne at 12/31/2003 9:04:33 AM
2 questions:
1. ALTER TABLE statements cannot be issued for temporary
tables. True of False?
2. ALTER TABLE statements cannot be issued for table
variables. True of False?
I'm pretty sure 2 is False. I get an error when I try 1 so
I'm thinking it's false too but would like a confirmation.... more >>
SQL Statement Help
Posted by Bill Papi at 12/31/2003 9:03:51 AM
I was thrown into admin for the SQL boxes here and had to
move a database from onw box to another. Now I thought I
had everything moved but I missed a DTS. I have the
source and destination created, but what I need is the
syntax for updating. What I am trying to do is create a
DTS that ... more >>
Constraining Values To A Permutation
Posted by David Snyder at 12/31/2003 8:55:16 AM
Hoping somebody can help me out here...
I've got a couple of column in a table that I would like to constrain their
values.
The first column is nvarchar(4) and can contain A, B, C or D in any
combination. Each letter can appear once or not at all, and in any order.
For example, A, ABD and D... more >>
Conditional stmts in SQL?
Posted by Gary at 12/31/2003 8:22:59 AM
I know that I can put all sorts of programming constructs in Transact SQL
but is it possible to put an if-then-else into a normal sql statement? I
want to put a conditional into a view creation. I have done this sort of
thing before with ISNULL and COALESCE.
I want to say something like: If ... more >>
Replacing CHR(10) or CHR(13) in field
Posted by Tim Bouscal at 12/31/2003 8:21:23 AM
I have a table with line feeds in some of the fields. I need to export this data but drop the extra line feeds in those fields. I've tried to use REPLACE but apparently don't quite understand the syntax. Can anyone offer a suggestion
Thanks... more >>
IF STATEMENT in store procedure
Posted by kda at 12/31/2003 8:21:15 AM
I have a stored procedure where if my cursor returns 0 I want to run a specific UPDATE and if it is not 0 then run a different UPDATE statement. How do I do the if statement in a cursor
SET @MyCursor = CURSO
FOR
SELECT dbo.tblTagPrint02.RETAIL_SKU, dbo.cp_sku_qty_retail_price.effective_time... more >>
xp_cmdshell
Posted by Binny at 12/31/2003 8:02:07 AM
I want to retrieve filename and file modified datetime
from a directory.
how can i accomplish this.
i tried dir \b but i don't get modified datetime
thanks
... more >>
Database standards
Posted by Ray Higdon at 12/31/2003 7:44:21 AM
Is there a recommended place to get database design standards for an
industry? I am specifically looking for information on standard data
collected for insurance type databases.
Any advice appreciated
--
Ray Higdon MCSE, MCDBA, CCNA
--
... more >>
better way for dynamic where clause
Posted by chris at 12/31/2003 7:34:21 AM
sql2k
So the lead developer has just informed me that he wants
our users to be able to specify the criteria they will
need in reports on the fly. (the where clause) What he
wanted to do was make our procs totally dynamic sql. My
suggestion instead was to use a view + a proc with dynamic
... more >>
SQL statement
Posted by Dean at 12/31/2003 6:57:21 AM
I created SQL statement listed below to list all object
permissions on the public role except the select
permission (193).
I would like to add to the SQL statement listed below to
eliminate the system object permissions.
Please help me with this task.
Thank You,
Dean
selec... more >>
BCP Error
Posted by NickV at 12/31/2003 6:46:10 AM
I am using the following line to export data from SQL Server to a text file. This has been running without any problem for a couple of months. We had to reset the server the other day and since then the BCP fails with the error below any idea
Command Used:
SET @Qry = 'SELECT LineValue FROM myD... more >>
Finding names that are similar
Posted by JOE at 12/31/2003 6:00:21 AM
Hi All,
I created my own replication that brings 20 different
SQL2000 SP3 databases into one huge 20gig database. I
have customer names in a varchar(50) field. Each of my 20
branches entered names in differently.
Ex. Wawa store 0001.. Wawa 0002..wawa 987
Anheuser Busch Incorporated.Anhe... more >>
Datatype declaration for parameters in stored proc
Posted by Wolfgang at 12/31/2003 1:16:11 AM
In ORACLE you can declare datatypes implicit like
PROCEDURE myProc (myParam myTable.myColumn%TYPE)
Is there any way to do the same in SQL Server ?
The problem is, if I declare datatypes explicit e.g. myProc( @myParam VARCHAR(50) ) and the datatype of the retated table-column is modified, ... more >>
|