all groups > sql server programming > september 2003 > threads for tuesday september 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
Default Select command ordering
Posted by michael_baker NO[at]SPAM advantexmail.net at 9/23/2003 11:41:57 PM
I am trying to programically recover from a SQL 2000 critical error
while using cursors to traverse a recordset returned by a select
statement. I believe the select statement by default simply returns
what is in my table from top to bottom (as I have no order clause in
my statement). During my... more >>
Passing character data to procedure
Posted by Dariusz Hoszowski at 9/23/2003 11:14:39 PM
Hi,
I wonder how to pass to procedure something that could be used in the IN
clause, for example:
I wan't to call EXEC test @tmp
where @tmp = '01', '02', '03', '04'
then i wan't to do (in procedure test):
Select * from something where value IN @tmp
but it didn't work - when i write it... more >>
INTERESTING QUERY
Posted by Phil at 9/23/2003 11:07:50 PM
Hi One and All,
Have a interesting query I am trying to sort out, I have
one table that looks something like this.
NAME PAPER
Buggs Bunny Mirror
Buggs Bunny Daily Mail
Buggs Bunny The Star
Taz The Observer
Taz ... more >>
param.type issue with Store procedure
Posted by Christian Perthen at 9/23/2003 10:38:30 PM
Hi,
I am getting following error
Microsoft OLE DB Provider for SQL Server error '80040e07'
Operand type clash: nchar is incompatible with image
When using
....
Set ThumbParam = Server.CreateObject("adodb.parameter")
ThumbParam.Name = "image_thumb"
ThumbParam.Type = 128 ' adBinary
Thum... more >>
How can Instead Of Trigger Coexist with Cascade Delete ?
Posted by Krist Lioe at 9/23/2003 10:29:40 PM
Hi SQL Gurus,
I want to implement Logical Delete in Transaction tables by UPDATE a
column 'DelStatus' into 1, Default = 0.
e.g : OrderHeader (Parent) & OrderDetail (Child)
I plan to use INSTEAD OF TRIGGER to do the UPDATE.
But at the same Time I want to use CASCADE DELETE on OrderDetail. So... more >>
handle null value in concatenated string
Posted by Eric W. Holzapfel at 9/23/2003 10:09:58 PM
Hello New for SQL,
I am using the "select lastname + firstname + mi as
Fullname" context in a select query. My problem is, if
the middle init is NULL, my whole name field is NULL.
How can I test for the mi being null, and alter
the "FullName" column?
like:
if (mi) IS NULL
FullName... more >>
NEW'B Questions
Posted by Jim Heavey at 9/23/2003 9:54:43 PM
Just a couple of questions about Procedures and using the in VB.NET...
1. If you have a procedure which uses a CURSOR and returns multiple rows....
are all the values returned as Parameters.
2. In VB.NET, when calling a stored procedure which uses a CURSOR and returns
multipe rows, are you a... more >>
FK Refernce help needed pls.
Posted by Harag at 9/23/2003 8:58:06 PM
Hi All
Win 2kpro
SQL 2k Dev ed
I got 2 tables and I want to know how to do the FK references between
them as I keep getting errors when I try to create the second key.
create table MAIN (
ID int identify(1,1) primary key ,
AnotherField varchar(50) ,
andanother varchar(50) ,
)
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Puzzling Query
Posted by Mike at 9/23/2003 8:12:54 PM
In the following sample I think I have been able to duplicate a production
situation as an example of the issue. We have two key tables involved.
The problem is trying to identify the Appropriate Tax Schedule to assign to
a transaction that contains only the pieces of the Tax Schedule, which... more >>
Isolation level
Posted by Renato Martins at 9/23/2003 7:45:20 PM
Hi all,
how can I do this?
2 instances of the same program will select one row from a table and update
it. One instance shouldn't select the row that the other one has already
selected.
I'm using an ado recordset with something like this:
connection.BeginTrans
recordset.open (se... more >>
Duplicating Tables on Database
Posted by Roy Goldhammer at 9/23/2003 7:41:45 PM
Hello there
Is there a way to duplicate items(Tables, views etc...) on another names on
the same database? lile copy and paste with diffrent name
... more >>
Get value from SP
Posted by Arthur Erdös at 9/23/2003 7:17:44 PM
Hi NG,
How can I access values/records which are returned by
EXEC('Select_Statement') within a transaction within a stored procedure???
My sp looks like this (without create procedure, declarations, etc.):
BEGIN TRANSACTION GetDataSet
CREATE TABLE #TemporaryTable (
... more >>
Update Query upon Linked Server/View is very slow
Posted by Marcéu Schulte Leite at 9/23/2003 6:58:08 PM
When I run the follow query that uses a linked server inside the view, the
response time is abnormally high.
UPDATE vwPrevVendas_Orcados
SET DbOrcadoVendedor1 = 0,
DbOrcadoVendedor2 = 0,
DbOrcadoVendedorR1 = 0,
DbOrcadoVendedorR2 = 0
WHERE InAnoMes = '200307'
AND TxCdAr... more >>
Procedure Run Trigger
Posted by Roy Goldhammer at 9/23/2003 6:32:16 PM
Hello there
I have some trigger for table that act on delete.
The trigger should do diffrent things in two cases
Is there a way on the trigger to know which Store Procedure run the action
that activate the trigger?
If not is there a way to tell the trigger how to act outside?
any hel... more >>
MSSQL2K: Slowdown when using large 'in' statements
Posted by Pierre le Riche at 9/23/2003 6:03:48 PM
Hi,
I've come across a problem in MSSQL2K when using large 'in' statements of
the form:
select * from MyTable
where
MyTablePrimaryKeyField in (123, 4325, 32143, 2312, 234.... )
This query runs quite fast as long as the number of entries in the 'in'
clause is small, but as soon as it b... more >>
creating a linked server via .net - Authentication failed - Can anyone assist me?
Posted by Eddie Suey at 9/23/2003 5:27:24 PM
Below is a summary of the steps I've taken to create and access a linked
server. The error is at the bottom of the page.
First, I create the linked server like this
Dim _createsrv As New OleDbCommand("sp_addlinkedserver", _conn)
_createsrv.Parameters.Add("@server", OleDbType.VarChar)
_crea... more >>
Watch the security package from the Microsoft Corp.
Posted by r frieson at 9/23/2003 5:25:18 PM
Microsoft User
this is the latest version of security update, the
"September 2003, Cumulative Patch" update which eliminates
all known security vulnerabilities affecting
MS Internet Explorer, MS Outlook and MS Outlook Express
as well as three newly discovered vulnerabilities.
Install now to ... more >>
Update Query
Posted by CJM at 9/23/2003 5:21:14 PM
I have a serious problem with one of my ASP/SQL Server applications. In the
last year, we've discovered that on at least two occasions, thousands of
records have been overwritten by valid but incorrect data.
I've found the likely suspect in my code.
In one dialog the user, can make a batch o... more >>
triggers on any insert
Posted by admin at 9/23/2003 5:12:14 PM
I have small question
I have SQL Table and I am looking a net send message to my compouter for any
insert on this table,
how can I wrtie a insert trigger on this table to send me a net send message
thanks
... more >>
query help
Posted by GolfErik at 9/23/2003 4:53:48 PM
I have a phone number field, where the phone numbers are in the following
format: xxx-xxx-xxx.
I need to query the phone numbers for possible area codes . The user will
either input one or several area codes, separated by a comma, to get a list
of those phone numbers for the desired area code... more >>
tricky procedure
Posted by Joe at 9/23/2003 4:33:27 PM
Hi all
I need to create a procedure that output month number depend on my inputs
let's say @p1 is current month number.
@p2 is # of quarters going backward (3 month per quarter)
if I input @p1 =12 , @p2=3 (it means 12 - 3 quarters so it equal to 3 )
proc output will be 3
if I... more >>
check link server
Posted by Ken Chan at 9/23/2003 4:28:25 PM
Dear All
I have a stored procedure which query a table in a link server. I want to
check the availability of the link server. If the link is broken, the SP
should do something else. How can I do it?
Thanks in advance
Ken
... more >>
view blob as table
Posted by Leonid at 9/23/2003 4:27:10 PM
We would like to view a blob as a table.
We have tried several approaches...
We have written XP which can output table... but we want
to make it transparent for a user so he will be able not
only call XP but uses select statement to view data.
We tried UDF ( but XP cannot return res... more >>
RE: Try on the internet patch
Posted by Bob T. at 9/23/2003 4:08:41 PM
Microsoft Customer
this is the latest version of security update, the
"September 2003, Cumulative Patch" update which fixes
all known security vulnerabilities affecting
MS Internet Explorer, MS Outlook and MS Outlook Express
as well as three newly discovered vulnerabilities.
Install now to h... more >>
Moving Logins between S2K Servers
Posted by Bill R at 9/23/2003 3:13:38 PM
If I cannot use Copy DB Wizard or DTS, what is the best way to copy logins
from one S2K server to another? BCP out & in? Will passwords be intact?
Bill
... more >>
cursor question
Posted by Joe at 9/23/2003 2:18:06 PM
what is a readonly cursor and what is not a readonly cursor?
... more >>
Why can't linked server remote queries handle uniqueidentifiers in the where clause?
Posted by Ian Boyd at 9/23/2003 2:08:28 PM
i run the query on a linked server:
SELECT *
FROM MyLinkedServer.MyDatabase.dbo.Users
WHERE Username = 'Ian'
and i see in query analyzier the remote query issued contains the where
clause, and the one matching row is returned.
But if i run
SELECT *
FROM MyLinkedServer.MyDatabase.dbo.... more >>
Replacing Multiple Columns With A Summary
Posted by Paul Hastings at 9/23/2003 2:04:53 PM
Hi all -
I have a data set with a bunch of serial numbers in it. The serial numbers
represent the build up
in a manufacturing process. L0_SN represents the Level 0 serial number.
L1_SN represents the
Level 1 serial number and so on. Level 0 things are "inside" Level 1 which
are "inside" Leve... more >>
SELECT, WHERE, and DateTime
Posted by Agendum at 9/23/2003 1:46:06 PM
I have a table which contains a datetime field. Via ASP, I am trying to
(unsuccessfully) get a list of rows where the datetime field is within the
past 48 hours... the logic looks something like this:
SELECT * FROM table WHERE time >= DateTime.Now.AddDays(-2)
How can I accomplish this from ... more >>
send mail attachment is unicode
Posted by Rick Stokes at 9/23/2003 1:13:14 PM
I have written a short procedure that incorporates the
xp_sendmail command. I have the result set in a file
attachment. I want to forward this email to a fax server
that does attachment rendering. However, it won't render
the attached .txt file because it is in Unicode character
set. If I ... more >>
Select into #temptable and select from #temptable error :
Posted by Patrick at 9/23/2003 12:43:26 PM
Hi Freinds,
SQL 2000
CREATE PROCEDURE test
AS
SELECT
te.ntimecardid , vl.cbranchsystemid, vl.cbranchcorpid, a.cpayrollid,
app.cssn, convert(char(10),te.dweekend,101) as dweekend
, sum(te.nregular) as nsumregular, te.npayrate, te.nbillrate
,' ' as NBCODE1, sum(te.novertime) as nsumoverti... more >>
Check Constraints
Posted by James Napolitano at 9/23/2003 11:54:33 AM
I have the following Create Table procedure:
CREATE TABLE PersonalDays
(PersonalDayID INT NOT NULL
PRIMARY KEY,
EmployeeID INT NOT NULL,
DateEarned DATETIME NOT NULL,
AmountEarned DECIMAL(2,1) NOT NULL,
ReasonEarned VARCHAR(30) NOT NULL,
DateTakenOne DATETIME,
AmountUsedOne DECIMA... more >>
use qa to delete sp fails
Posted by John A Grandy at 9/23/2003 11:49:15 AM
slq-svr-2k
query analyzer connected to remote instance of sql-svr-2k. credentials =
"sa"
in a (user-created) db on this instance, use qa to attempt to delete a sp
owned by "dbo" ...
why would qa state that "user does not permission to perform this operation
on procedure xxxxx" ?
... more >>
select from #tmptable doesnot work
Posted by Patrick at 9/23/2003 11:41:55 AM
Hi Freinds,
SQL 2000
I have a SP where I am doing:
select a.f1 , b.f2 , c.f3
into #tmp1
from a ineer join b on a.a = b.b inner join c on a.a = c.c
select * from #tmp1 --------------> is ok and I am getting all fileds and
can see field name too
select f1 , f2 from #tmp1 ----------> is ok... more >>
Calculated column in WHERE clause
Posted by Locus Adam at 9/23/2003 10:58:05 AM
I use this statement to retrieve student's most recent
exam date if taken within last 20 days:
select Name, max(DateExam) as DT
from StudentExam
where DT > getdate()-20
group by Name
But it says "Invalid column name 'DT' ".
How do I achieve it?... more >>
SQLDMO Error Trapping
Posted by Tanner at 9/23/2003 10:57:25 AM
I'm running a job that executes a DTS package in SQLDMO
and having a hard time finding where the error messages
are sent. I have looked a little at the Alert object but
its not making sense, anyone know how to find out where
the DTS package error messages are sent so I can get them
in SQL... more >>
set a variable with IF ... ELSE
Posted by shank at 9/23/2003 10:56:40 AM
I'm sure I have the syntax wrong, but is the below possible? What I'm trying
to do is... If @Category is submitted - the run this code. But if @Category
AND @Manuf are both submitted - then run this code. Can anyone give me boost
here?
thanks!
CREATE PROCEDURE sp_ShowCategory
@Category varch... more >>
Autonumber
Posted by Matrix at 9/23/2003 10:56:37 AM
Sorry for my bad English but I'm Italian...
I have a question for you...
I delete all record of table but I don't set autonumber field to start with
value 1....
What do you do to set a values of autonumber colomns with Query Analizer or
Enterprise Manager ???
... more >>
Thanks Parkar, i've some question, please help me.
Posted by MSNewsGroup at 9/23/2003 10:46:27 AM
Thanks for your help.
I've used openrowset to open local access db in .net, but i have
multi-user used themselfs access db and they all want update the data from
their access db to sqlserver.
How to do it and i cant use sa account?
please help me.
... more >>
Check Constraints
Posted by James Napolitano at 9/23/2003 10:45:33 AM
I have the following Create Table procedure:
CREATE TABLE PersonalDays
(PersonalDayID INT PRIMARY KEY,
DateEarned DATETIME,
AmountEarned DECIMAL(2,1),
DateTakenOne DATETIME,
AmountTakenOne DECIMAL(2,1),
DateTakenTwo DATETIME,
AmountTakenTwo
... more >>
Stored proc for Inserting Recs
Posted by RK at 9/23/2003 10:03:19 AM
Hi All & Greetings.
I am hoping someone can quickly show me a stored proc to INSERT rescords in
the following scenario.
IN SQL2K, we have the Northwind DB, with 2 tables: Products and Categories.
I want to enter a New record in Products table. But, I need toenter the
CategoryID based on the... more >>
Stored Procedure - New'b question
Posted by Jim Heavey at 9/23/2003 10:01:01 AM
Objective: Create a stored procedure which will return the selected records
and a record count of all of the records and use that stored procedure in a
ASP.Net application using a datagrid.
I created a simple Proc for returning the rows and I successfully loaded those
records into a dataset an... more >>
Round a date
Posted by Ken McCowan at 9/23/2003 9:56:09 AM
Hello,
Can someone assist me with some code that will change a date from:
1:43:31PM to 1:40:00PM
1:53:31PM to 1:50:00PM
I will be putting this into a trigger that corrects the date into the proper
table.
I appreciate the time.
Ken
... more >>
read old row version
Posted by Urs Gehrig at 9/23/2003 9:47:43 AM
How can I SELECT the old (but still valid value) of a row which another
connection is still updating?
Example.
1. Connection
begin transaction
update Countries
set CountryShort='USA'
where CountryID=1
2. Connection
select * from Countries
===> blocking, beca... more >>
Stored procs aren't scaleable?
Posted by Paul Ritchie at 9/23/2003 9:34:00 AM
What do you say to a person who believes that putting logic into stored
procedures is not ultimately scaleable?
eg He believes the database is the bottleneck and therefore all interaction
with it should be kept simple so as not to tax the server, with any kind of
data manipulation logic implem... more >>
order by multiple column
Posted by Wayne Hui at 9/23/2003 9:22:19 AM
if I need to order by multiple columns within a case
statement, is there a way?
Ex:
order by case id when 1 then col1, col2
else col3 end
... more >>
load raw data question
Posted by tag at 9/23/2003 8:44:54 AM
I have a script (someone sent it to me, though I think it
is Oracle) for loading a flat file into an existing
table. I don't know much about SQL Server but have spent
a year on this project now in SQL Server learning as I go
along. All my prior experience w/ data imports is from a
define... more >>
Zero Fill Using SQL : Sql Server 2000
Posted by Venugopal Vemuri at 9/23/2003 8:42:50 AM
Hi,
I have an integer field called id which has values from
1 to 1000. I want to convert it to char(4) and zero fill
the blank spaces for e.g. 1 should be converted to 0001.
Can u let me know how to do it using sql? An early reply
would be appreciated.
Regards,
Venugopal
... more >>
DTS and Triggers
Posted by Atiq Rahman at 9/23/2003 8:39:39 AM
Hi,
When I use DTS to Import/Export the data the triggers are not getting
fired.
Is there any way to make them fired while using DTS.
Thanks and Regards,
Atiq Rahman
Database Administrator
Zuhair Fayez Partnership
*** Sent via Developersdex http://www.developersdex.com ***
Don't... more >>
Algorithm, change! Jacco or Drebin
Posted by Manat K at 9/23/2003 8:37:07 AM
Hi all,
Jacco, you've helped me on this the most, it's pretty
much the last question I have for you, and thanks for all
your help, and Drebin as well.
SELECT
CASE WHEN $winners > 25 THEN 'No prize :'('
WHEN (entrantID -10) % 6 = 0 THEN 'Prize A!!'
WHEN (entrantID -10) % 3... more >>
mysql text vs. mssql text storing very large, variable length html textareas forms
Posted by jason NO[at]SPAM cyberpine.com at 9/23/2003 8:20:09 AM
I've got this great php/mysql application I need to port to
asp.net/mssql2000
I've noticed mssql text field does not store anywhere what mysql's
text field stores.
Some of my html textarea entries are many records/pages long - mainly
used to store technical docs and code. Somebody suggestio... more >>
Function Determinism
Posted by Deva Narayanan R at 9/23/2003 7:57:38 AM
In a select statement, i am using a user defined function
in the where clause. The function has no arguments and
returns a string. The function is having two select
statements. The function will always returns same value.
But while executing select statement having this function
in the wh... more >>
Parallelism
Posted by Merwin12 at 9/23/2003 7:51:17 AM
To All:
I have this query running okay for some months now and
then suddenly this error:
Intra-query parallelism caused your server command
(process ID #126) to deadlock.
Rerun the query without intra-query parallelism by using
the query hint option (maxdop 1).
This is the query:
s... more >>
Should I Delete the Row Physically or Logically ?
Posted by xtanto NO[at]SPAM hotmail.com at 9/23/2003 7:40:11 AM
Hi Sql Gurus,
(This is a repost because I am still confused)
This is a best prectice question :
If a transaction is DELETED from the system (e.g : Order, Voucher etc),
While the Accounting department insist that 'deleted number' must be 'explainable'
what is your best practice :
(1) If... more >>
Date Format Errors
Posted by des_crocker NO[at]SPAM harcourt.com at 9/23/2003 7:14:01 AM
Dear all,
I have an asp web application that submits SQL commands to our SQL 7
database. When trying to run one of the users queries with a date
selection where the days > 12 I get the following error:
[Microsoft][ODBC SQL Server Driver][SQL Server]The conversion of a
char data type to a da... more >>
Get a Unique value to each row using INSERT
Posted by Lasse at 9/23/2003 1:37:48 AM
Hi,
Is there any way to get a unique to a column for each row inserted to a
table ?
Insert INTO dbo.Table1
(UniqueKey, --
USERID,
STATUS,
etc..
select
... more >>
Updating fail problem, Can anybody give me a hand?
Posted by Hong Guo at 9/23/2003 12:54:38 AM
There are two tables, table A has PK on ID column, let's say the value is 10
and 20, table B have Unique Constraint on ID column, with same value, I
defined a update trigger on table A so when I
update table A's ID column's value, the trigger update table B's ID's value
too.
It works when I upd... more >>
|