all groups > sql server programming > october 2004 > threads for friday october 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 29 30 31
Sending message from sql to program
Posted by majid947 at 10/15/2004 11:29:04 PM
I'd like to my program notified from som inserting or updating in database.
At present i use a timer in my program to check database.
Is any way to send a notification message from sql to my program .... more >>
Syntax for Table with Get Date?
Posted by Steve at 10/15/2004 10:39:01 PM
Hi,
Can someone please help me with the following
I have to create a table & it should have get date() with it. For example
Table Nmae: CustomersOct16.
I am building a DTS package. Due to large volume of data I am partitoning
the Table on weekly basis. Data load comes in each week theref... more >>
Want non-composite result set from select with multiple joins
Posted by Gridlock at 10/15/2004 9:43:04 PM
Suppose a database has three tables labeled T1, T2, &T3. Each table has two
columns labeled T1-1, T1-2, T2-1, etc. T1 has one row, T2 has two rows, & T3
has three rows. Consider the following statement:
select T1-1, T2-1, T3-1
from T1
join T2 on (T1.T1-2 = T2.T2-2)
join T3 on (T1.T1-2... more >>
Strange behavior with identity columns...any advice?
Posted by Jonathan Furman at 10/15/2004 6:59:43 PM
I've just run into a strange issue with identity columns and reseeding
tables. I first came across it will working with a transfer objects task in
DTS but it looks like the problem is noticable even with straight T-SQL.
What happens is that sometimes an empty table will reseed after a DBCC
comma... more >>
Diffdate
Posted by Jesus Cardenas at 10/15/2004 6:44:05 PM
How shuld be the sql statment for get the difference of two dates in Months
and Days?
ej :
2004/01/01 - 2004/02/10 --- Result : 1 Months and 10 Days
... more >>
How to replace .. OR ANY ,AND.. : SQL Performance issue
Posted by marina.sukhnev NO[at]SPAM thinknet.com at 10/15/2004 5:34:50 PM
Hi everyone,
I have some performance problem,I have query that runs for 20 sec,
I need maximum time of 10 sec,because it opens folders,Is it possible
to replace and not/and with something else,but to keep logical
order,any ideas?
select parent_id from dmr_content where (ANY parent_id IN
('... more >>
Tricky subquery
Posted by Jon J. at 10/15/2004 4:53:11 PM
Hi all,
How would you write a SELECT query for returning all Projects whose current
StatusID = 10, given the following schema:
Project Table:
ID - identity
Name
StatusHistory:
ID - identity
ProjectID - fkey
StatusID
Date
I've been using MAX(Date) but perhaps there ... more >>
Using time part of DATETIME in criteria
Posted by Tod at 10/15/2004 4:44:53 PM
Here is an easy one for somebody.
How do I use just the time part of a DATETIME field in a
criteria?
For example, in Access, if I want to return a count of
records where the date is between October 1st, 2004 and
October 31st, 2004 AND the time is between 8 am and 5 pm,
I can do somet... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
two instance sql server
Posted by js at 10/15/2004 4:43:28 PM
Hi, if I have two instance sql server running in a local machine, and I have
a schedule job need to run(osql) a query file. how to specify(or how to
know) which instance to run? thanks.
... more >>
Processing incoming SQL mail
Posted by SJ at 10/15/2004 4:21:05 PM
Hi all,
If I have SQL mail all set up on a SQL 2k box, with the local email client
all ok, connecting to Exch 2k I can use SQL mail ok...
Up until now I use SQL only to SEND emails using xp_SendMail.
My question is,
I would like to now process incoming emails, specifically, to strip thei... more >>
why do char columns slow down query?
Posted by Al Blake at 10/15/2004 4:17:50 PM
If I make a query against a table and pull back just a couple of columns
(one int, one date):
select RTEID, RTEDateTime
from rtetable
where
datediff(hour,rtedatetime,getdate()) < 24
(839 row(s) affected)
it takes about 5 seconds to complete:
SQL Server Execution Times:
CPU time ... more >>
create table
Posted by Ralf Pelzl at 10/15/2004 4:02:05 PM
Hello,
i've create a procedure that have to create a table. The table name is the
parameter of the procedure.
create proc [dbo].[CreateReportTable]
@TblName varchar(10)
as
if object_id(@TblName) is null
create table [@TblName] (a varchar(10))
go
I call the procedure 'execute Cre... more >>
Creating tables using Enterprise Manager - Description box
Posted by mgm at 10/15/2004 3:43:28 PM
Where is the data stored when the description field for column is filled? I
tried to open profiler and save a table to see what happens, but I don't
understand profiler enough to figure it out.
I wanted to create a table that will contain the "data definition" for all
the fields in my databas... more >>
Strange behavior using a Dynamic Cursor.
Posted by Cary at 10/15/2004 3:25:01 PM
This is a little hard to explain but I'll try.
I am trying to create a Stored Proc that will access our ERP system to
create a Work Order tree as the system we have will not do it on it's own.
The procedure I have uses a Dynamic query going down through the rows and
adding new rows when a... more >>
Short-circuit does not appear to be working
Posted by Thomas C at 10/15/2004 2:53:19 PM
Suppose I have the following:
Declare @Var Bit
Set @Var = Null
Select *
From dbo.Anytable
Where @Var Is Null
Or Exists(Select * From dbo.AnyOtherTable)
When I look at this in the query analyzer, it shows that the system executed
the Exists statement. If short-circuit is working,... more >>
Simple merging question...
Posted by Mr Sandman at 10/15/2004 2:23:51 PM
Ok, newbie here... how do I merge two sql tables using query analyzer?
This seems like it'd be so simple, yet I keep generating errors. I have two
"select into" statements pulling from different locations, they each produce
a table of output. I need to take those two tables of output and combin... more >>
"Smart" Product Codes
Posted by Mike Labosh at 10/15/2004 2:16:53 PM
We have these 14 digit codes that are composed of other codes:
ProductCode: 00090023014399
Where:
0009 = Vendor Code
0023 = Prod Code
014 = Version Code
399 = O/S Code
There is a lookup table for each of these four sub-codes, and all four of
them have similar structure to this:
... more >>
Error 7399: MSDAORA
Posted by Nery at 10/15/2004 2:07:03 PM
Hi there,
I am trying to link an oracle server, i have already installed oracle client
tools 8.1.7 but I cannot connect to that server and throw this exception...
Error 7399: Ole DB 'MSDAORA' reported an error. But it does not give more
information.
My DTC is running, SQL server SP3a inst... more >>
CASE Statement and Null value - Some records do not show up.
Posted by Marco Napoli at 10/15/2004 1:34:27 PM
I am using a CASE Statement in the WHERE clause in order to filter by a
certain salesperson_id or by ALL.
WHERE (CASE WHEN 'ALL' = @mSalespersonALL THEN salesperson_id ELSE
@mSalespersonId END) = salesperson_id
------------------------------------------------------------------------------
... more >>
Simple merging question...
Posted by Mr Sandman at 10/15/2004 1:29:14 PM
Ok, newbie here... how do I merge two sql tables using query analyzer?
This seems like it'd be so simple, yet I keep generating errors. I have two
"select into" statements pulling from different locations, they each produce
a table of output. I need to take those two tables of output and combin... more >>
Cannot debug!!!
Posted by Ed at 10/15/2004 1:27:02 PM
Hi,
I don't know why all the stored procedures cannot be debugged.
I right click on the name of the SP and click on debug and click on
Execute (the stored procedure has no input parameters but has lots of local
variables).
then what happen was it runs through the whole procedure and print... more >>
Stored procedure dependencies
Posted by Alan at 10/15/2004 11:58:16 AM
use northwind
go
create procedure [dbo].[CustOrderHistRep]
@CustomerID char(5)
as
select ContactName, ContactTitle
from Customers Where CustomerID = @CustomerID
select ProductName, total=sum(Quantity)
from Products P, [Order Details] OD, Orders O, Customers C
where
c.customerID = @customer... more >>
Update an other database with a trigger
Posted by Stefan Willem at 10/15/2004 11:56:58 AM
Hello,
a "USE" is not allowed in a trigger, so how can I update a field in an other
database?
For example:
CREATE TRIGGER [TRIGGER NAME] ON [TABLE_IN_DB1]
FOR INSERT, UPDATE, DELETE
AS
UPDATE TABLE_IN_DB2
SET Field = 1
WHERE TABLE_IN_DB2.Nr = '123'
Thanks in advance
S. W... more >>
Newbie select question
Posted by dotnw NO[at]SPAM hotmail.com at 10/15/2004 11:40:41 AM
Hello,
I would like to do a select like this:
select top 400 (...etc)
then, before the stored procedure ends and returns it's results, I
would like to do this:
return the last 100 records only from the above select
In other words, I would like to return records 301 to 400 only from
... more >>
Query run very fast in Query Analyser but extremely slow in client application through ADO/ADO.NET
Posted by Terence at 10/15/2004 11:39:40 AM
Hi,
I have a stored proceudre that run very fast in query analyser. However,
when this stored procedure is executed through
a client (e.g. Windows Forms + ADO.NET), it perfroms super slow that results
in time out.
Additional information:
- The stored procedure returns multiple recordset
... more >>
Failed to copy objects from MS SQL Servert to MS SQL Server
Posted by Agoston Bejo at 10/15/2004 11:15:20 AM
I'm trying to copy objects and data between 2 SQL Server databases using the
import/export wizard in SQL Server 2000.
I select the source and destination database and leave everything as
default. When I try to run the DTS Package, it stalls at 22% for a few
minutes, then goes up to 96% or so ver... more >>
variabe in a LIKE clause
Posted by Marc Miller at 10/15/2004 11:14:59 AM
I have a select with a LIKE clause referencing a variable. But it returns
no results.
Can't seem to get it to work. I guess it will need some extra single quotes
and + signs i.e. LIKE (''%' + @Bldg_name + '%'')
I've tried several variations.
Here is my proc:
Create PROCEDURE sp_FindByBld... more >>
Log file - where to look?
Posted by mgm at 10/15/2004 11:07:04 AM
Would the SQL server log file log if a user-made stored proc. ran?
This is my dilemma - since the person is away that created this we don't
know where to look. I've been asked to find out if an automated email has
been sent out that I am assuming is ran via a stored proc. (querying the
dat... more >>
Sum of values
Posted by simon at 10/15/2004 10:30:36 AM
I have columns in my table:
productID(int) dateBuy(date) color(varchar) country(int)
price(float) procent(float) quantity(int)
I would like to select all that columns and at the end I would like to have
row with sum of price,procent and quantity.
Is that possible with rollu... more >>
database diagrams
Posted by John at 10/15/2004 9:55:06 AM
Is there a way to add a table that resides in one database to a diagram that
resides in another database?
... more >>
sp_xml_preparedocument, XML parsing error: Not enough storage is available to complete this operation
Posted by Oleksandr Brovko at 10/15/2004 9:36:28 AM
We are using sp_xml_preparedocument/OPENXML to parse XML on server (MS
SQL 2K SP3). Most of the time xml size is less then 100K, but some times we
receive up to 1M XMLs. Everithing works fine for about 2 weeks - 1 month,
but at some point on files ~500K we start getting
"XML parsing error: ... more >>
ACCESS PROJECT, MS GRAPH, STORED PROCEDURE
Posted by Zlatko at 10/15/2004 8:57:57 AM
I am dealing with very frustrating problem: I don't know how to pass
parameters to the stored procedure which is row source of MS Graph in Access
PROJECT form.
The problem apears because there is no Input Parameters property on the MS
Graph (unlike forms)...
Of cours, I can pass parametrs expli... more >>
Query
Posted by Peter Newman at 10/15/2004 8:47:04 AM
Im trying to create a query to return when the latest crediting period
started and the credit value to dat from the start of the last period.
The sample data below is only a small represation only as entries for all
customers go gack to Jan 04.
I need to find the first entry in the table f... more >>
Crosstab question
Posted by Carl Imthurn at 10/15/2004 8:32:12 AM
I believe I need a crosstab query to achieve my desired recordset, but
can't quite figure out the syntax.
Here's a subset of the data I'm working with:
StudentID RequirementID Done
J89 17 15
J89 29 270.5
J89 30 0
J89 ... more >>
table variables -- urgent
Posted by Sri at 10/15/2004 8:09:16 AM
I use table variables extensively in the stored procedures .
I am doing inserts and updates to the table variables in the stored procs .
Do they cause recompilations.
if so how can i prevent it?
Also the other question i have is i
In lot of stored procedures i did not use any temp tabl... more >>
Alter table command
Posted by AS at 10/15/2004 7:25:10 AM
Hi
Does anyone know the TSQL command for altering a table to add adentity type
for a column? I usually just use Enterprise Manager...
Thanks
AS... more >>
BCP Format
Posted by Sam at 10/15/2004 6:45:34 AM
Hi, is there anyway to specify the format of the BCP file through the DBLib
fuctions. It always defaults to the native format. I tried to look at the
options for the bcp_control function and could not find any option to set
character mode. Any ideas?... more >>
Incorrect sorting in a query
Posted by Nigel Mark Billinge at 10/15/2004 6:35:01 AM
The following query :
SELECT WOG_SEARCHCODE, WOG_OID
FROM dbo.ITSM_WORKGROUPS
WHERE (WOG_SEARCHCODE LIKE 'ITSC%')
ORDER BY WOG_SEARCHCODE
returns the following results :
ITSCA-OPSSM 281490634573090
ITSCAP-AS400 281606145773628
ITSCAP-ASAP 281517028016134
ITSCAP-ASIS ... more >>
SQL Server Constraints
Posted by BFS at 10/15/2004 4:53:02 AM
We have used triggers to enforce referential integrity in our SQL Server
database. The triggers cascade changes and deletes of the primary keys to
tables where that primary key is a foreign key.
Based on recommendation of significant performance increase, we are now
trying to switch from t... more >>
Help with Case statment
Posted by Peter Newman at 10/15/2004 4:35:04 AM
Im hoping someone can pick up on this error withoiut me having to generate
the DDL cose
Basicly the @FileProcessingDaily is a money, and im trying to get it so
that is the return from the select is a NULL then make @FileProcessingDaily
= 0.00. Ive tried replacing NULL with ISNULL but get... more >>
Changing a primary key data type
Posted by Peter B.L. Rasmussen at 10/15/2004 4:09:06 AM
I need to change the data type for a column that is part of the primary key
of the table from int to nvarchar(15). I will have to get rid of the primary
key constraint first, bu I can't seem to figure out how to do it.
The constraint (or whatever it is) was originally created by Microsoft
A... more >>
How to make a Foreing Key?
Posted by Jesus Cardenas at 10/15/2004 1:16:05 AM
I've this tables
Header
entry
customer
....
Detail
entry
line
partnumber
....
Items
customer
partnumber
description
How can I make a Relationships Detail - Item when I don't have the field
customer in the table Detail
I've MSSQL 7
I hope the cuestin is clear...
Thanks... more >>
Database Design - Urgent!
Posted by alexcn NO[at]SPAM writeme.com at 10/15/2004 12:39:46 AM
Hi there,
I am trying to set tariff data for accounts and transaction types in
an application without having to set a tariff for every combination of
accounts (and their groups) and transaction types (and their groups)
Basically very rough example layout is as follows:
Account: ID, AccountG... more >>
Tracking data changes
Posted by Jiri Svoboda at 10/15/2004 12:13:24 AM
Hi,
I need tracking changes data on selected columns on selected tables and
somewhere store,who and when change value.
How you resolve it.
MS SQL 2000
Jiri
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!... more >>
|