all groups > sql server programming > february 2005 > threads for tuesday february 15
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
API functions
Posted by mtgoli at 2/15/2005 10:57:02 PM
hi
How can I use an API function in a stored procedure in sql server 2000?
tanx... more >>
Query, what's wrong here?
Posted by Henry at 2/15/2005 10:30:02 PM
Hi
I get an error when I try to limit the "digits" I want to summerize, I have
only added the line
"and digits in (select digits from series)"
when it there the it fails and gives the errpr Msg 446, Level 16, State 9,
Line 8
The only thing I can imagine is that it's because I'm "joining" w... more >>
raiserror / terminate a users connection
Posted by Nick Stansbury at 2/15/2005 8:02:07 PM
Hi,
For slightly convoluted reasons I'd like to be able to terminate a users
connection from within a stored procedure, in a similar way as if I'd raised
an error with a severity of 20 or above. Is this possible?
The circumstances are that I have a number of security tests that I run at
... more >>
Can someone tell me what this means?
Posted by CTG at 2/15/2005 7:15:02 PM
Rc = SQL_Query(
"SELECT TerminalOptions, RRDays, InstallerId, IcePakPhone, Snak,
ScreenSetID, TerminalConfiguration, MaskOptions "
"FROM Terminal "
"WHERE (CustomerID=?) AND (TerminalID=?)",
SQL_C_LONG, &lMerchatIdenity, sizeof(long),
SQL_C_CHAR, Field[F_TERMID], strlen(Field[F_TERM... more >>
MSXML vs SQLXML
Posted by Prabhat Nath at 2/15/2005 6:13:21 PM
Hi All,
I have Downloaded both MSXML 4.0 SP2 and SQLXML.
Are they are same. If not can any one please tell me what for that both are
used?
Thanks
Prabhat
... more >>
Query too complex
Posted by ericvdb at 2/15/2005 6:05:08 PM
Hi all,
can someone help with the following problem?
TBL_PRODUCTS
--------------------
Prod_code
A
B
C
D
....
TBL_FCST
------------
Prod_code FCST_QTY FCST_GRP FCST_PERIOD
A 10 1 1
A 20 ... more >>
trigger
Posted by Emmanuel at 2/15/2005 5:31:08 PM
Hi,
Why would a trigger work from everywhere except from where you really want
it to work?
I have a table with a trigger set for insert. the trigger updates a column
from another table. When i insert a row from enterprise manager, query
analyzer, another stored procedure, vbscript - ... more >>
SQL Syntext For comparing and Removing values that have already been selected
Posted by Faizal Tan at 2/15/2005 5:06:31 PM
Hi there i was wondering if theres a statement where it will compare the
items tht has already been selected and saved . I came across "NOT IN" but
its not exactly the one i need. Any Advice? P.s. is there such a thing
as " IsNotIn" ? Thx.
Rgds
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Extended Stored Procedure
Posted by Mark - HYPERe at 2/15/2005 4:59:03 PM
When I run the below (sp_OACreate) in SQL Query Analyzer it runs fine. When
I add the same to a stored proc my app hangs and I get a timeout.
Any help is greatly appreciated. I really don't want to create a job that
runs this.
EXEC @hr = sp_OACreate 'MyLocalEXE.Host', @object OUT, 4
IF ... more >>
Roles
Posted by news.microsoft.com at 2/15/2005 4:29:27 PM
I need to take about 300 SP's and strip out whatever permissions are
assigned to them - then add one role:
db_procexecutor_write to each one.
For example - at the bottom of this SP is:
.....
go
GRANT EXECUTE ON dbo.p_CnsAct_i TO WINADMIN
go
GRANT EXECUTE ON dbo.p_CnsAct_i TO WINCNS
go
GR... more >>
Triggers Vs RI
Posted by Adrian Parker at 2/15/2005 4:07:56 PM
Having ported to use SQL server, we're having a pretty severe problem with
RI.. to the point that we can't use it.
The problem is that we have lots of tables using the following kind of
relationship..
paint {
paintID int,
paintDesc varchar(40)
}
panel {
panelID int,
... more >>
import accessfiles with stored procedures
Posted by Jason at 2/15/2005 3:39:19 PM
Hi,
Could somebody tell me how to import access-files to a sql server database?
I would like to import all tables from access to the temp, do some
data-manipulation and then insert into a database. I know that dts can
import, but i want to address the tempdb so i don't have to create
tempta... more >>
Sum error?
Posted by PO at 2/15/2005 3:27:04 PM
Hi
(SQL Server 2000)
I use the following SQL to retrieve data:
SELECT
sum(case when LEFT(TR.ACCOUNT,1) = '3' then -TR.AMOUNT else 0 end)
Revenue,
sum(case when LEFT(TR.ACCOUNT,1) = '4' then TR.AMOUNT else 0 end)
Cost,
RTRIM(TR.DIM_4) Workorder
FROM
... more >>
Disabling Foreign Key Constraint in Trigger
Posted by AST at 2/15/2005 3:11:18 PM
Hey,
Can anybody tell me how to disable a Foreign Key contraint from executing
while a Trigger is executing on DELETE event?
Best regards,
Bill
... more >>
StoredProc or Dynamic SQL?
Posted by Mark at 2/15/2005 3:09:59 PM
Hi - I have an SP called from ASP.Net, which has a where statement which
should read:
CREATE PROCEDURE getActivitiesAvailFromList
(
@activitylist varchar(4000)
)
AS
SELECT activity.activityid, activity.activity, activity.description,
activity.costperperson, activity.duration
FROM ... more >>
asynchronous select statements
Posted by Jeremy Chapman at 2/15/2005 2:57:23 PM
We have an application deployed on two seperate machines both reading from
the same database. The applications poll the database every few seconds and
find the first record in a table that has a bit field set to 0x0. The
application then updates the field to a value of 0x1 and then do some
pro... more >>
Division
Posted by Dave S. at 2/15/2005 2:21:54 PM
Newbie Question.
While using a query/subquery to get a percentage I keep getting zero. I
assume this is becuase the number returned is less than 1. How can I make
this work right?
Example
Select 123/12345
returns 0 when it should equal 0.00996
I have tried converting using decimal(... more >>
Concurrency issues in trees
Posted by Robert Schuldenfrei at 2/15/2005 2:17:36 PM
Hi NG,
My indented Bill of Materials (BOM) report has been working for some time
now. It is time to deal with the issue of multiuser operations and
concurrency. My approach has been to use the tree spanning algorithm
suggested by Steve Kass. This stored procedure builds a table called
... more >>
Delete from takes a very, very long time
Posted by Joe at 2/15/2005 2:13:19 PM
I have a table with around 38000 records in it. I'm trying to delete records
(about 3000) from it but it takes forever!
There has been several million rows added and removed from this table before
but now it's taking way too long (currently 7 min and running).
I'm doing delete from my table ... more >>
checking the type of a column
Posted by Jeff Robichaud at 2/15/2005 2:06:34 PM
Hello,
I want to make an ALTER COLUMN to change a column's type (say VARCHAR to
TEXT), and I need to check first if the given column has not been changed
yet (the command will be in a script that will likely be runned more than
once and I don't want SQL Server to raise an error if the colum... more >>
Incorrect syntax near '='
Posted by Niels Verkaart at 2/15/2005 1:54:16 PM
Hi,
I'm using multiple select statements in MS-Access with logical
expressions like (ID=10)*50 instead of an if statement. In this manner
i'm able to get the same results as with if statements (if ID=10 then
result=50) only faster (in MS-Access that is).
when trying to get the same sql stat... more >>
DBCC CHECKIDENT
Posted by Alien2_51 at 2/15/2005 1:41:08 PM
I have a command line utility that calls the MapPoint.NET web service that we
use to geocode addresses, during the process I have a table that gets
reseeded using DBCC CHECKIDENT, I insert the results of the command line
utility into the table.. For some reason the identity column on the table... more >>
TSQL Query dynamic where clause - if statement
Posted by Datasort at 2/15/2005 1:29:19 PM
I am wondering what is the best way to perform a query where there MIGHT BE a
where clause used. I do not want to use an if statement
For instance: I have a query where there might be a vendor specific sort
If @Vendor <> null then
Select blah blah
From tblX
Where vendor = @Ve... more >>
Creating a Trigger which updates a linked server
Posted by mickymickmc NO[at]SPAM yahoo.fr at 2/15/2005 12:54:31 PM
Hi all,
I read some message in FAQ about my problem but i doesn't work any
more...
I have 2 SQL-Servers that use sql-server and windows security
integrity.
On first Server, i add a linkServer to the other by using
sp_addlinkedserver and use a specified user ...
So i can use select com... more >>
implementing hierarchy
Posted by Flip at 2/15/2005 12:54:05 PM
I'm an MS person, I love SQL Server, but the one feature I would wish MS
would implement is an easy way to get hierarchical information out of SQL
Server!
Maybe I'm missing something, but I've read a few articles about trees like
this one (http://www.developerfusion.co.uk/show/4633/) and al... more >>
SELECT query riddle
Posted by Eric Tishkoff at 2/15/2005 12:49:03 PM
create table A (
GroupNum int,
Dt smalldatetime,
Score int
)
go
insert A values (1, '1/1/2005', 24)
insert A values (1, '1/2/2005', 28)
insert A values (2, '2/1/2005', 27)
insert A values (2, '2/2/2005', 24)
insert A values (2, '2/2/2005', 26)
For each GroupNum, report the Score for... more >>
Table Spool/Lazy Spool is a symptom of what?
Posted by Ian Boyd at 2/15/2005 11:55:24 AM
i see a Table Spool/Lazy Spool operation that is turning 20,879 rows into
34,512,987. And then after a Nested Loop/Left Outer Join to 1,653 rows, it
is turned into 1,653 rows.
My question is, what is the Table Spool/Lazy Spool trying to do?
To help explain my question, i can give a similar... more >>
Efficiency of is null v\s nullif
Posted by prabhakar at 2/15/2005 11:18:26 AM
hi ,
i am querying for data in which i compare nulls . And null = null for my
scenario. Thus i need to either use extra where conditions in the query to
check if the two compared fields are nulls. This i can do either by using is
null or nullif function. Which of the two options will be more ... more >>
A lot of sp_cursorfetch in profiler.
Posted by Geir Holme at 2/15/2005 11:15:31 AM
Hi all.
I am looking at some profiler logging and gets a lot of the lines looking
like:
exec sp_cursorfetch 180150024, 2, 0, 1
This comes after running a simple prosedure that select some lines.
All i VB6. I guess it has something to do on how we retrieve data (ADO).
Does anyone have... more >>
Server Name Incorrect!
Posted by Jason at 2/15/2005 10:39:45 AM
We got a new database server (also a Win2003 domain server). Got the
databases over there fine, up and running fine. Ultimately we named it the
same as the previous server to simplify some of our processes. That worked
fine too, and it can be referenced on our intranet as "Server" via SQL,
W... more >>
call order
Posted by jduran at 2/15/2005 10:23:12 AM
If a VIEW and a STORED PROCEDURE exist and have the same identical name -
is there a particular call sequence that SQL SERVER uses -
in other words if the particular name is called up in code - does SQL pull
the view first or the SP first.... more >>
Getting Error 208 on Table variable in select clause
Posted by LeAnne Jergensen at 2/15/2005 10:07:07 AM
I have a stored procedure that contains a table variable.
Declare @xxxx table
(columname columtype)
In the stored procedure there is a select against the table variable after
it has rows inserted into it. When the stored procedure is called via .Net
code, we are seeing in Profiler 208 e... more >>
Comments in SP
Posted by Emmanuel at 2/15/2005 10:03:50 AM
Hi,
I was wondering if the amount of comments inside a stored procedure could
hinder in any way the performance of the same sp. Does anyone know?
regards,
... more >>
Log everything
Posted by Agoston Bejo at 2/15/2005 9:25:42 AM
Hi,
I've been using SQL Server for a while, but I'm fairly new to this area.
I would like to log every error that occurs in every stored procedure that I
call (actually from an ASP page, but I don't think this is relevant). One of
my stored procedures sometimes (as far as I can determine, quite
... more >>
Problem with Stored Procedure Execution Plan
Posted by Kevin Terrill at 2/15/2005 9:17:03 AM
I have a backup of a database, (same structure, data, [updated index]stats),
but the execution plan of a stored procedure is completely different on a
different machine that I restore it to.
I didn't think the query processor used any environment variables during the
query optimisation phas... more >>
Parent-Child relationship
Posted by PH at 2/15/2005 8:21:11 AM
I have a field which is the primary key in table A, and in table B i have the
same field which is the foreign key.When it comes to deleting a record I
should kill the child first.If i try to delete the parent then i get an
error, which is expected. But if i turn the delete cascade option on, i... more >>
Min except for zero
Posted by jhcorey NO[at]SPAM yahoo.com at 2/15/2005 8:03:13 AM
We have a complex query with many aggregate functions.
For one column where we return MIN, we would like to return the minimum
non-zero value.
I don't think using HAVING is going to work, because we don't want to
exclude any rows from the result set.
We're thinking of doing something like MIN(c... more >>
Problem with query taking a long time.
Posted by Reza Raquib at 2/15/2005 7:33:03 AM
I have a large SQL table, called Event, that has 4.6 million records in it.
My problem is that one particular query on the table is taking over 30
seconds to run. All the other queries that I have take under 1 second to
run. I have tried numerous index changes, but it seems that nothing hel... more >>
Dropped or missing newline character
Posted by BootieDay at 2/15/2005 7:29:02 AM
I imported MySQL tables into an Access MDB and confirmed that the Access
table preserved the embedded new line (0x0A) characters within a memo field.
I then used an Access append query to insert data into a linked MS-SQL 2000
table consisting of an NTEXT field. The embedded newline character... more >>
transfer logins and roles to another server
Posted by sudha at 2/15/2005 7:23:01 AM
Can anyone give me some ideas of how to transfer all the logins and roles
from one server to another?
I tried running the sql script but doesn't work properly and gives me errors
and doesn't show up in enterprise manager tree.
now when i try to connect using the login,it gives errors and wh... more >>
Get recordset result in variables
Posted by Bob at 2/15/2005 7:21:42 AM
Hello folks.
I am running a series of queries in a stored procedure.
For example, my first query might return a recordset like this
Apples
Oranges
Pears
Turnips
I want to put those reults in variables
So I might have
Declare @Fruit1 char(10),@Fruit2 char(10),@Fruit3 char(10),@Fr... more >>
Simple query
Posted by hecsan07 at 2/15/2005 7:21:01 AM
I am a true newbie in T-SQL. I want to write a store procedure to return a
row of a table where the date field is less than today. Can someone help
please?
HS... more >>
Update Rows from other Rows
Posted by Sue at 2/15/2005 7:19:03 AM
My data is like:
Proj1 Task1 5
Proj1 Task2 4
Proj2 Task1 Null
Proj2 Task2 Null
Proj3 Task1 8
Proj3 Task 2 Null
I already have figured out the WHERE clause to exclude Proj3. What I want
to happen is an UPDATE so that
Proj1 Task1 5 ... more >>
How to speed up my update process
Posted by SQLDBA71 at 2/15/2005 7:15:01 AM
Hi,
I need to update a table which has almost 300 million records and it is
growing. Initially I had clustered index on the primary key (int column)
later I changed it to nonclustered index because I don't want to rebuild that
every night. But now one of my update statement is taking long t... more >>
Is it possible to access query designer through an interface?
Posted by Kurt at 2/15/2005 7:09:06 AM
Is it possible to access query designer through an interface like sqldmo?
Thanks
Kurt... more >>
Shutdown Sequence 0
Posted by Graham at 2/15/2005 7:03:34 AM
Can Anyone tell me what is Shutdown Sequence 0. I have had
three SQL jobs cancelled with this event and am trying to
find what caused it.
Thanks... more >>
Linked Server - Query
Posted by Gerard at 2/15/2005 5:25:05 AM
Hey all,
I have an Access app that need to be able to Query a Linked Server. The
Linked Server points to an Access Database. When I put the Access App on the
SQL Box where SQL 2000 and the Linked Database reside, I am able to Query the
Linked Server from the Access App with a SELECT or ... more >>
Query Help
Posted by Peter Newman at 2/15/2005 4:49:11 AM
Im trying to write a query that will return the next daily sub number and
Volume number for our submissions. the volume number is easy as it is
incremented each time, but the Daily sub number needs to be reset each day.
Each time a submission is made the numbers are incememted
ive come up... more >>
Suspect Databases and Hidden Attributes
Posted by gopi at 2/15/2005 1:38:00 AM
Hello All,
I had posted this in the SQLServer.Server group as well. I just want to add
that after
a reboot of the machine, the files of databases that were in Suspect mode
disappeared. I had copied
the same file in other location while I was trying to restore the databases.
However, even
... more >>
IP Address or MacAddress
Posted by mtgoli at 2/15/2005 12:07:02 AM
Hi
I want to know that is there a system sp or table or somewhere in sql server
that I can get ip address or mac address of clients that connect to sql
server?
thanx... more >>
|