all groups > sql server programming > september 2006 > threads for wednesday september 27
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
How to error trap SP within trigger ?
Posted by Rob at 9/27/2006 11:39:03 PM
Assume you have the following situation...
CREATE TRIGGER testtrigger ON dbo.Orders
FOR INSERT
AS
DECLARE @OrderID VARCHAR(20)
SELECT @OrderID = OrderNumber
FROM Inserted
BEGIN
EXEC prProcessOrder @OrderID
END
If the stored procedure prProcessOrder fails, then both the... more >>
concatenate and format the text data in insert/update trigger
Posted by moondaddy at 9/27/2006 11:26:13 PM
I need to update a denormalized column in an update trigger and am looking
for a good way to do this. (we have good reason for denormalizeing it into
a read only field so lets not talk about why we should not denormalize it)
This is an example of what I need to do. for example, lets say I ha... more >>
DB Design Question.
Posted by Ankith at 9/27/2006 11:20:22 PM
Hi Everyone:
I am trying to come up with a good db design for time tracking an employee's
time on one of the client projects that I am working on. The background is
as follows:
1). An Employee can work on administrative tasks and also some special
projects.
2). An Employee can also work... more >>
How to make a random search in SQL 2005
Posted by Marcos Lommez at 9/27/2006 10:46:43 PM
How can i make a random search?
... more >>
Reg DTS Package..
Posted by samay at 9/27/2006 7:17:25 PM
hi can any one help me in this issue.i use to get one text file as an
attachment from one email id weekly.the file name and email id is
same.so i want that file to be automaticaly imported to a table and
updated as per the schedule i have assigned.so wen i get that mail that
pervious table sho... more >>
Select rows based on occurance of other records
Posted by richardb at 9/27/2006 6:54:01 PM
This is a database of medical charges. To simplify, say columns are
ChgSeqNumber PatUniqueID ServiceDate Procedure FinanceClass ProviderCode
----------------- -------------- ------------- -----------
--------------- ---------------
1234 123AAAAA 09/20/2006 93307 ... more >>
SqlDependency message timeouts
Posted by flanger at 9/27/2006 5:14:02 PM
I finally got SqlDependency working in my Web application. It turned out to
be not too hard. The dep.start() is called from global.asax.cs and I created
a class dedicated to registering the SqlDependency to a handler. When I
change my table, my registered handler gets called, does some work... more >>
confused about OUTER JOIN
Posted by Rick Charnes at 9/27/2006 4:09:41 PM
I have two tables, FILE_INFO and FILE_BOX, with common fields file_no
and file_date. I want to select all rows from FILE_INFO that have a row
in FILE_BOX matching on file_no **but either matching or not matching**
on file_date. In other words, I want to do a regular inner join on
file_no b... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Rounding with DECIMAL data type
Posted by Terri at 9/27/2006 3:08:56 PM
I'm expecting 0.032377624944, not 0.032377000000.
Can someone enlighten me? SQL Server 2000 SP4.
DECLARE @var1 decimal(24,12)
DECLARE @var2 decimal(24,12)
DECLARE @var3 decimal(24,12)
DECLARE @calc decimal(24,12)
SET @var1 = 398.9
SET @var2 = 365
SET @var3 = 4496886.36065
SET @calc ... more >>
Question as to why dates have two quotes as ''2006-09-26 17:05:30:730'' in Profiler
Posted by Farmer at 9/27/2006 2:58:05 PM
Hello,
thanks for your time and effort.
This is in SQL 2005
Here is an issue I try to find an answer for.
In the SQL Profiler I capture stored procedure calls that have datetime
supplied as a parameter.
I use SQL trace to collect workloads for the Database Engine Tuning Wizard .
When ... more >>
Excluding Weekends from SQL Query
Posted by gavin.walters NO[at]SPAM gmail.com at 9/27/2006 2:20:14 PM
So I know this is an repeat of many other posts, but after reading them
all, I still have questions...
I have already created a calendar table as dictated in
http://www.aspfaq.com/2519.
I have another table with two sets of dates that i need to figure out
the difference between the two with... more >>
How to select an image in 2005?
Posted by Lamborghini at 9/27/2006 2:04:02 PM
Is there any special way to send an image from a table to a web page?
I know in SQL 2000 I have to readtext and writetext when selecting a text or
ntext fields.
Thanks,
E.... more >>
problem with row(s) affected
Posted by SQL Learner at 9/27/2006 2:00:07 PM
SQL Server 2000.
Inside a stored procedure I wrapped and update in 2 print statements as
follows:
PRINT 'e'
UPDATE dbo.MailNotificationRecipients SET SendTo = @SendTo, CopyTo =
@CopyTo
WHERE UserGroupID = @UserGroupID
PRINT 'f'
The output is suprising to me
e
(1 row(s) affect... more >>
Date in stored procedure for VB 6 code
Posted by Sandy at 9/27/2006 1:17:02 PM
Hello -
I have a stored procedure with date as one of the parameters. The date is
supplied in VB 6 with a DateTimePicker with a format of M/dd/yyyy.
Because of the fact that Sql Server uses the entire datetime when comparing
dates, I am running into the problem that it returns no rows i... more >>
VBS to SQL Connection (Alternate Connection Method)
Posted by Matthew at 9/27/2006 1:05:10 PM
I have a simple script that I am using to connect to a SQL server,
read, process and then write back information. The script works right
now, but I am wondering if there is a better way to connect up to the
SQL server. Right now I am using CreateObject("ADODB.Connection")
strings to connect. Is ... more >>
Delimited Seperators
Posted by Doug at 9/27/2006 12:56:49 PM
Hi,
I'm not real sure this is the right group to send to but I'll start
here. I"m looking for some opinions on delimited seperators. What I'm
trying to do is get data from sql and put it into a flat file and use a
seperator between each column of data. I was going to use comma's but
then r... more >>
Very poor query performance
Posted by njaminder NO[at]SPAM hotmail.com at 9/27/2006 12:38:42 PM
I'm trying to do a semi-complicated query and unexpectedly getting very
poor query performance. Here are the details.
-- Table1 has 4.5 million rows.
CREATE Table1
(
id int identity(1,1) not null,
ip_from bigint,
ip_to bigint,
city_id int
isp_id int
)
GO
ALTER TABLE dbo.... more >>
Looking for tutor in SQL for MS Sql Server
Posted by spot at 9/27/2006 11:55:49 AM
Please respond to the email address, and indicate geographical
location, times available and price. Also resume and references would
be nice.
... more >>
Adding Field With Hardcoded Value In SELECT...INTO Query
Posted by racquetballer NO[at]SPAM hotmail.com at 9/27/2006 11:47:30 AM
If I'm creating a new table by doing a SELECT..INTO query, and I want
to create a new field in the new table that doesn't exist in the old
table, and I want that field to have a hardcoded value, how would I do
that?
For instance, say I'm running this query:
SELECT DISTINCT Right(franchise_c... more >>
Need help with setting variables; DDL included
Posted by Terri at 9/27/2006 11:17:12 AM
CREATE TABLE #Test
(
A decimal (6,2),
B decimal (6,2),
C decimal (6,2),
D decimal (6,2)
)
INSERT INTO #Test (A,B,C,D)VALUES ( 5772.74,0,6086.09,3445.25)
SELECT * FROM #Test
DECLARE @MaxColumn varchar(1)
DECLARE @MaxColumnValue decimal(6,2)
DROP TABLE #Test
My data at this point... more >>
How to avoid use cursor in this situation
Posted by James at 9/27/2006 10:07:28 AM
I have a function to convert string to a table.
If you pass string like '1,2,3,4,5' to it, it returns
1
2
3
4
5
Here is the question:
I need to parse strings stored in another table. I use cursor to do
this job in my sample code below.
How can I avoid to use cursor in this situation ... more >>
Transaction and result code
Posted by mr_doles at 9/27/2006 9:54:51 AM
I am by no means a SQL person, so this may be a very simple question.
I am writing a vb.net (2.0) app that calls a SP on a SQL server. This
SP deletes rows from multiple tables. I have two questions:
1) How do I modify the SP to create a transaction in case one of the
deletes fails?
2) I ... more >>
Is there a better way?
Posted by Marc Miller at 9/27/2006 9:51:56 AM
Is there a better way to obtain the sums by cust_key other than this? It
seems
like a long way around to get the end result, but if I leave 'a.minutes' out
of the
subquery and run it alone, it, of course, gives the error that 'a.minutes is
invalid in the select list.........etc".
SELECT ... more >>
select count from Except query
Posted by Stephane at 9/27/2006 9:37:02 AM
Hi,
I want to know which id are in a period of time and have not been there
before so I'm using the except clause to get the count from a an Except
query. I tried something like this:
select count(*) from
(select id from vw_reports_ip where startTime between '2006/09/26' and
'2006/09/28... more >>
Questions on PASS 2006 Community Summit in Seattle
Posted by Alex Kuznetsov at 9/27/2006 8:53:20 AM
What are General Sessions all about? Do you think they are worth
attending? Why or why not?
How do you guys dress for such events? (I work in a very casual
environment, for me dressing up means jeans not shirts ;).)
-----------------------
Alex Kuznetsov
http://sqlserver-tips.blogspot.com/
... more >>
Service Brokers
Posted by SK at 9/27/2006 8:48:57 AM
Hello,
I am trying to learn the SQL Server 2005 Service Broker component. Can
anyone point me to good articles on this?
Thanks
S
... more >>
access to database using stored procedures only for security making sense?
Posted by Sam Jost at 9/27/2006 8:08:59 AM
For security reasons I thought it might make sense to allow access to a
database only by stored procedures, to make sure data changes are
consistent and disable direct tampering with the content of tables and
rows.
Does this make sense?
And how do I set database access rights (using windows
... more >>
Dead Lock problem with same sequence of commands
Posted by YS Ram at 9/27/2006 7:40:02 AM
Hi,
We have run in to this interesting dead lock issue and any suggestion on how
to overcome this will be helpful. To simulate this
1 BEGIN TRANSACTION
2 INSERT INTO FOO (MyField) VALUES (1)
3 SELECT * FROM FOO
4 COMMIT TRANSACTION
Copy the above script (I have given line numbers for e... more >>
Is this a Valid Date Time
Posted by Skip at 9/27/2006 7:29:37 AM
Hello,
Is this a valid date time format for use in SQL2005?
2006-09-25-16.49.45
The data is coming from an Interbase DB and the application was
designed in Germany. Right now SQL does not recognize it as a valid
date time field.
Thanks
... more >>
Cannot perform an aggregate function on an expression containing..
Posted by Rob at 9/27/2006 7:01:03 AM
Hi,
When I try to run the following...
SELECT
SUM(CONVERT(DECIMAL(12,3),ISNULL(round(sum(ft_net_amount),3),0))) as Tax
From A
QA repots... Cannot perform an aggregate function on an expression
containing an aggregate or a subquery.
So, I tried breaking it down into smaller chunks, as... more >>
SS2005: database growing very quickly
Posted by Craig HB at 9/27/2006 6:58:03 AM
Since we have upgraded our server from SS2000 to SS2005, our databases have
been increasing in size very quickly. One of the databases has increased from
4 gb to 7 gb in a week. This is much more growth than we had before and,
besides the upgrade, nothing else has changed.
I have changed t... more >>
Non English Characters
Posted by saygin NO[at]SPAM gmail.com at 9/27/2006 5:53:59 AM
Hi,
We are developing a small web interface to a local ERP software, which
uses SQL Server 2000 as database. The database uses SQL_Latin1_CP1
collation, and the fields are varchar (not nvarchar), however, the main
program inserts and reads non-English (Turkish) characters into these
columns. Ho... more >>
Best ERD design apps ?
Posted by bringmewater NO[at]SPAM gmail.com at 9/27/2006 5:29:09 AM
Are there any ERD design apps that work for MS SQL, Postgres and MySQL?
I'd like to buy one powerhouse app for reverse/forward engineering,
documentation and model updates but want one that works for these three
databases.
If there isn't one can you tell me what the best ones are for them
in... more >>
SP performance problem
Posted by ulrik NO[at]SPAM pragmasoft.dk at 9/27/2006 3:58:57 AM
I have a stored procedure that sometimes takes a long time to finish.
When a run it now from the Query Analyzer via:
"EXEC sp"
it takes about 15 seconds, but if a run the select statement in the
stored procedure like this:
"select * from xx"
it only takes 1 second?!
So it looks like... more >>
Group by clause on date value
Posted by Jami at 9/27/2006 3:23:34 AM
Hi
i am using following query
Select name,address, edate from abc
group by edate
edate has a type of datetime and date as well as time portion also get
stored. i o0nly wantts to group data on date value not time value how
can i achive this
regards,
Jami
*** Sent via Developersde... more >>
Simple query, same database, same plan - difference in io - 2473 t
Posted by Oskar at 9/27/2006 2:43:01 AM
Hi,
Here's a simple query
SELECT dbo.RemoveSpecialSymbolsFrom(UPPER(VarcharColumn)) FROM Table1
I ran this query in my production DB and in the DB I restored from a
production DB copy on a test server, which had same software versions (MS SQL
Server 2000 SP3 + Windows Server 2003 SP1) but... more >>
Date Problem in VB
Posted by Pedro at 9/27/2006 2:34:14 AM
Hi evreybody,
I have a problem with dates.
I have a date with this format: dd-mm-yyyy and I have to change it to
yyyy-mm-dd.
Any ideas how to do it?
... more >>
How to use variable in USE method?
Posted by mark at 9/27/2006 2:29:55 AM
I wrote a store procedure like this:
declare @dbname nvarchar(50)
declare db_cursor cursor for
select name as database_name from master.dbo.sysdatabases
where has_dbaccess(name) = 1 and (name like '[0-9]%')
open db_cursor
FETCH NEXT FROM db_cursor INTO @dbname
WHILE @@FETCH_STAT... more >>
Questions about MSDE and SQL 2005 Server Express
Posted by Tony Girgenti at 9/27/2006 12:20:22 AM
Hello.
I don't understand the SQL Databases.
I was once using MSDE of SQL2000(Server name = DHJC2R91). Since playing
with VWD, i downloaded and installed SQL Server 2005 Express Edition(It gave
me a server name of DHJC2R91\SQLEXPRESS). After that when i use the systray
icon with the li... more >>
index and performance
Posted by khotrahul NO[at]SPAM hotmail.com at 9/27/2006 12:07:07 AM
We have a fairly large LEDGER table. Whenever we run a query(stored
procedure) to get the AR, it accesses almost all records for that customer.
We have indexes on this table to. SQL index tunning wizard also suggested
one INDEX, which we have added.
Now suddenly from last 4 weeks we are e... more >>
surrogate key in master detail tables
Posted by Alex Bibiano González at 9/27/2006 12:00:00 AM
I have a master table (Orders) with a surrogate key (OrderID) as identity.
Now I have a detail table (OrderDetail) also with a surrogate key
(OrderDetailID) as identity and a foreign key to OrderID.
What is the best aproach to define my PrimaryKey and Indexes for the
OrderDetail table:
1)... more >>
@@Error problem, execution terminated
Posted by Tarvirdi at 9/27/2006 12:00:00 AM
Dear Friends,
I have a procedure that I want detect error if occurred, I used "@@ERROR"
but don't work! why?
The routine that I wrote is as bellow (table t1 not exists to generate
error)
procedure stopped at error and didn't continued.
---------------------------------------
ALTER procedure... more >>
|