all groups > sql server programming > march 2005 > threads for wednesday march 23
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
Critical Error Trapping in SQL Server
Posted by ourspt at 3/23/2005 10:53:01 PM
Hi,
I have a situation where I need to give a custom error message in an SP
where I get a primary key violation. I tried this with the @@error variable
as in the following code.
CREATE PROCEDURE TESTspt1PROC
AS
insert into testspt1 values (1, 'spt')
if @@error <> 0
PRINT 'it is a Pri... more >>
sp_executedsql and @@NETSLEVEL
Posted by Jean-Nicolas BERGER at 3/23/2005 9:17:56 PM
Could someone explain me the second answer of this query :
select @@nestlevel
go
sp_executesql N'select @@nestlevel'
go
-----------
0
-----------
2
I expected 0 and 1 ...
Thx.
JN.
... more >>
How to handle SQL errors with severity 10
Posted by E B via SQLMonster.com at 3/23/2005 8:20:46 PM
how to handle sql errors with severity less then 10 in .NET
i call to stored procedure which raise error with severity 10 for example
however in c# i can't cach this error (with severiry >= 11 it going to the
catch block in my c# app), also the @@ERROR is equal to zero when severity
<= 10
-... more >>
80 mode
Posted by harry at 3/23/2005 6:19:57 PM
Hello everybody.
What mean if server is runninf in the default 80 mode
What are 60, 65,70 mode.
Thanks for all respond.
... more >>
DTS utilizing stored proc
Posted by Robert Richards via SQLMonster.com at 3/23/2005 5:51:53 PM
I am trying to create a DTS package to send results from an extended stored
procedure [master.dbo.xp_fixeddrives] to an Access table.
What is the best Task to use in order to call an extended stored procedure
in DTS?
--
Message posted via http://www.sqlmonster.com... more >>
Data schema for storing arbitrary order
Posted by A Ratcliffe at 3/23/2005 5:37:22 PM
Currently this is purely hypothetical, though I'm semi-considering something
like this for part of a current project. I'm wondering how to apply a
pseudo-order to a set of data.
To give an example, if you were storing Service Ranks, which were
referenced by the service personnel you stored... more >>
ITW says workload does not contain events or queries to use
Posted by Eachus at 3/23/2005 5:23:04 PM
Hi,
I'm having trouble getting the Index Tuning Wizard to analyze my workload.
I'm using SQL Server 2000. I've run the ITW against several different trace
files, and keep getting an error that says, "The workload does not contain
any events or queries that can be tuned against current datab... more >>
bit mask
Posted by Igor Marchenko at 3/23/2005 5:21:31 PM
Hello,
I have 300 groups. Each user can or can not be associated with certain
group. I would like to represent group membership using corresponding flag
(on/off). Using integer dattatype it will look like : G1- 1, G2 - 2, G3 -
4.....
If user is member of group of 1,2 and 3 it will be re... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Insert to other db?
Posted by Lasse Edsvik at 3/23/2005 4:12:58 PM
Hello
how do I insert to an other db using a insert-statement?
INSERT INTO OtherDBsTable(Something)
SELECT Something FROM ThisDBsTable
TIA
/Lasse
... more >>
unable to begin a distributed transaction
Posted by Eugene Yen at 3/23/2005 3:53:02 PM
Hi All:
We encounter a distributed transaction error in a stored procedure that uses
database links to do select and update queries over two databases. Two
procedures were created with the same structures and query almost the same
tables. One of them works well even now. But the other enco... more >>
UPDATE linking 3 tables
Posted by David C at 3/23/2005 3:22:47 PM
I need to create an UPDATE statement that links 3 tables in order to update
one of them (WorkerDeductions.DeductionBalance). Below is the code I have
so far but am not sure how the UPDATE statement would be coded. Any help is
appreciated.
UPDATE dbo.WorkerDeductions
SET dbo.WorkerDeducti... more >>
i need idea for bus transport databse
Posted by TomislaW at 3/23/2005 3:13:35 PM
i have many buses that drive between many cities. some of the buses connect
more than 2 cities in one line...
... more >>
xp_cmdshell priviledges
Posted by Sean at 3/23/2005 2:47:03 PM
First off, I know that only members of SA can execute xp_cmdshell...
That said, is there a way to make this work:
I have a stored procedure that utilizes xp_cmdshell to pull file information
from a directory. The process gets the file names, renames, moves to archive
and compresses.
Th... more >>
Converting to decimal
Posted by gv at 3/23/2005 2:07:39 PM
Hi all,
OK, I'm sure very simple question, what am I doing wrong.
how do I get the percentage? of 68 / 1812
@result keeps showing 0.00
Declare @result varchar(20)
set @result = cast(round(100 * (68 / 1812) , 2)as numeric(5,2))
print @result
thanks
GV
... more >>
maximum length of database objects in sqlserver 2000
Posted by RayAll at 3/23/2005 1:45:27 PM
what 's the maximum length of database objects in sqlserver 2000?
Thanks
... more >>
Most efficient way?
Posted by Fab at 3/23/2005 1:45:15 PM
Hello,
I have 2 tables;
I want to create a query that will show only records that DO NOT Exists in
another table.
Now I know I can do a select with an EXISTS but I wanted to know if this is
the fastest way as I will be dealing will millions of records.
Any ideas?
... more >>
UDF Parameter
Posted by HappyPagan at 3/23/2005 1:45:06 PM
I am trying to call a User Defined Function whilest feeding it a dynamic
parameter instead of a literal. The UDF returns a table:
CREATE FUNCTION fn_GetSubAgents(@agtpin decimal(7,0))
RETURNS @AgentList TABLE
(
pin_sur decimal(7,0),
sch_nam char(40)
)
AS
BEGIN
INSERT ... more >>
SQL Query - Please Help
Posted by Nicholas at 3/23/2005 1:37:04 PM
Hi,
I have the following query that I can't figure out why it won't work. I'm
getting the following error in SQL Query Analyzer:
Syntax error converting datetime from character string.
If I change the sortBy value to any value other than 2 it works just fine
and returns results. I can't... more >>
division in a view
Posted by notme at 3/23/2005 1:34:06 PM
In trying to simplify an overly complex query [at one time, 1000+ views and
14 queries run in query analyzer!], I am trying to incorporate many of the
different views/queries together but am having troubles with one thing;
trying to divide one of the columns in a view.
SELECT FIPS, [MTG... more >>
Unable to Logon to SQL Server
Posted by Chris Jones at 3/23/2005 1:27:03 PM
I have a SQL Server 2000 database set up on my local machine, set to mixed
mode authentication. I also have an ASP.NET web service running on the same
machine. When the web service is called, it connects to the db using a
connection string from the web.config file.
Whenever I try ... more >>
use of RND in proc?
Posted by Al Blake at 3/23/2005 12:37:21 PM
We have to allocate pseudo-random password to primary aged students.
RedDog1
BlackCat3
you get the idea.
I have the seed words stored in a table and I need to extract them at
random...so I need to be able to gernate random INTEGERS between 1 and 10 to
pick the seed word(s). I am very confu... more >>
trigger always firing!!
Posted by AW at 3/23/2005 12:21:04 PM
I have a trigger on FOR INSERT, but even when I just change data in an
existing row, the trigger fires!! Why would this happen? I have the
trigger on a replicated table -- does that have anything to do with it?
Please help, I'm going crazy.
CREATE TRIGGER trigIncidentInsert ON [Incident... more >>
designing for encryption ...
Posted by Bob Castleman at 3/23/2005 12:10:21 PM
In light of SARBOX, ChoicePoint security breaches, identity theft etc, what
are some best practices regarding encryption and security of this type of
info? I know this is a pretty broad question, so links to other sites are
great, but I'd like to hear some personal experiences and opinions.
... more >>
simple lock question - help?
Posted by Newbie at 3/23/2005 12:06:27 PM
If I update a row using one connection and leave the
transaction open is it true that another connection can't
read any rows from the same table. That is what I'm
seeing in query analyser - an IX lock at the table level
which prevents any reads.
Please help me....... more >>
INSTEAD OF TRIGGER
Posted by Alien2_51 at 3/23/2005 11:27:02 AM
DISCLAIMER: I didn't design this, can't change it, have to deal with it...
If an application updates a primary key on a table that has a compund key,
will I be able to access the old primary key values as well as the new in an
INSTEAD OF TRIGGER...?... more >>
The index is created from which columns?
Posted by krygim at 3/23/2005 11:25:04 AM
In the sysindexes table, what field stores the columns which an index is
based on?
TIA
... more >>
Problem with Group By and Sum
Posted by Joshua Campbell at 3/23/2005 11:22:49 AM
I am trying to get a sum of the dollar amount for each term for each
customer. Unfortunately, the same value for sum is returned, so I thinkt
hat I have my query wrong. My query looks like this:
SELECT sales.name, sales.terms, t_order_term.order_term_description,
SUM(sales.prodamt) AS TheSum... more >>
Yukon sqlcmd error when executing CLR Stored Procs
Posted by Manu Puri at 3/23/2005 11:17:05 AM
The following is what a customer is seeing:
He writes CLR stored proces in SQL 2005 and then executes them using sqlcmd
scripts, occasionally he gets the following error:
Sqlcmd: Error: Microsoft SQL Native Client : Unknown token received from SQL
Server
Any help you can provide is grea... more >>
Export one DBF and then ftp to the others?
Posted by Agnes at 3/23/2005 11:08:43 AM
In vfp, I can set the table as free table. and just copy *.dbf to other PC,
and then I can use it.
In SQL, I try that I can only export the table into text , csv.... excel
etc.
If i want to import that excel, ALL the width is set to nvarchar 255.
Does there is any simple way, I can copy th... more >>
drop ALL indexes statement available?
Posted by Cory Harrison at 3/23/2005 10:48:46 AM
I am writing a script that takes a database and will make all new indexes.
I have about 150 identical databases but they all have slightly different
indexes due to usage, profiler and tuning wizard set them all up separately.
So I want to start from scratch. Is there a statement I can use to ... more >>
Compiler Error Message: BC30451: Name 'changelang' is not declared.
Posted by selena NO[at]SPAM selenabil.com at 3/23/2005 10:34:54 AM
I have created 2 ASP pages that gives users the option of switching
back and forth between French and English. They click on the word
English and it converted the text to English and the French link
converts the text to French. In the ASP page with the form on it there
is an includes file pointi... more >>
table names with spaces
Posted by rk325 at 3/23/2005 10:08:04 AM
Hello,
I setup replication between 2 computers, but it keeps crashing because
(I think) the database table names include spaces. I have the option to
go through each individual replication stored procedure (3 per table)
and edit them adding [] to each....but I'm replicating more than 100
tabl... more >>
DROP TABLE IF EXISTS
Posted by 11Oppidan at 3/23/2005 9:15:07 AM
Hello,
Forgive me if I am being stupid, but I cannot get some syntax to work and I
need it urgently. I want to drop a table if it exists and make a new table
in its place. I though I could do,
DROP TABLE IF EXISTS tablename;
CREATE TABLE tablename ([ID] [int] NOT NULL)
but I get the ... more >>
Meta Data retrieval
Posted by Kayode Yusuf at 3/23/2005 8:11:10 AM
Greetings -
I need to know how I can retrieve the Meta Data Information about a procedure.
I know I can use SET FMTONLY ON to retrieve it but I need to retrieve this
dynamically - I need a call that will return a resultset containing the
information
instead of just a header info.
TIA... more >>
Arithmetic overflow error - in a changed table!
Posted by volps NO[at]SPAM hotmail.com at 3/23/2005 7:23:17 AM
Hello.
I had a table with identity column set to datatype [smallint]. I've
reached near 32800 records. That's the limit for [smallint].
So, I've changed the identity datatype to [int], that SHOULD allow me
to have more records. But the error continues.
"Arithmetic overflow error convertin... more >>
Input values into SP while running?
Posted by mjcast at 3/23/2005 7:13:04 AM
Is there a way in SQL server 2000 to read a value into a stored procedure
while it is running?
for example using a
PRINT 'Enter a Value'
this puts the line in the results window.
Is there a way to read in a value from the result window for use in the
stored procedure?
Thanks in adva... more >>
Null values
Posted by Robert at 3/23/2005 6:37:02 AM
I need to get data from a table with <NULL> in a date field. My query looks
something like this:
select batch_id, visit, reg_date
from daily_batch
where cpi = 6800 and post_date = NULL
This should bring back a record but it does not. cpi 6800 exists and the
post_date field is <NULL>.... more >>
Immediate processing of large recordset with VB
Posted by DB at 3/23/2005 5:54:59 AM
I have a table with roughly 165,000,000 records. Within
this table is a subset of roughly 6,000,000 records I
need to retrieve and process sequentially with some VB
code. These records are identified by a numeric code in
1 field. There is an index built on this field. When I
run a sim... more >>
Removing NULL in CASE ELSE
Posted by krish at 3/23/2005 5:37:03 AM
How to compress the output into single line
if got the below output using case..else
9155 michael NULL NULL NULL
9155 NULL NULL narain NULL
9155 NULL NULL NULL karthik
9155 NULL shumaker NULL NULL
Thanks
krish... more >>
query analyzer's issue
Posted by Enric at 3/23/2005 5:01:04 AM
Dear all,
Because of the large amount of live servers i am obligated to have in my
desktop
six or seven query analyzer sessions (linking servers is forbidden) against
them.
Sometimes and suddenly i lost my keyboard configuration and when I touch the
* key appears another character (th... more >>
Enter char
Posted by x-rays at 3/23/2005 4:39:11 AM
Hello experts,
I think this is an easy question for you...
I do an Insert in a "character type" column (nvarchar) and the value has
enter chars. In detail, I build dynamically a string and use the char(13)
character, the enter char is inserted as a "rectangle char" instead of
pragmatic ent... more >>
Case sensitivity
Posted by RioDD at 3/23/2005 3:57:04 AM
Hello,
I'm writing a function witch from an string (nvarchar) gets the characters
and converts them. I have the problem with case sensitivity. I get the
results in small letters but I need them to be in the exact case as the input
values, and must not change the SQL Server's settings. I've t... more >>
DBCC CHECKIDENT within Transaction
Posted by Subramaniam Sivakumar at 3/23/2005 3:19:09 AM
Hi,
I am getting problem when I use DBCC CHECKIDENT with in a Transaction.
Please advice on this.
--
Regards
Sivakumar... more >>
Insert Statement
Posted by Stephen at 3/23/2005 2:31:04 AM
I am trying to complete an insert statement for user logins in order to keep
a record of all the times users login. Can someone help me with the statement
below. Thanks very much for any help anyone can give me.
CREATE PROCEDURE [LoginValidation]
@p_UserName char(12)
AS
SELECT UserName, P... more >>
|