all groups > sql server programming > november 2003 > threads for friday november 28
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
Delete child record - need help understanding
Posted by Jonah Olsson at 11/28/2003 11:57:31 PM
Hi guys,
Below is two related tables. If I need to delete a lot of records from the
child table (EmailGroupMembers) but the deletion must not result in records
on its own (without a EmailGroup member that is..) in the parent table
(EmailAddresses), how should I think? Can I achieve that witho... more >>
Stored Proc's and "where" clause
Posted by Gary at 11/28/2003 9:38:08 PM
I know I can put a 'case' statement in the 'select' portion of the sql query
in a stored proc, but is there anyway that I can create the "Where" part
based on a value passed into the proc?
Every time I try to 'case' the where part, I get nasty errors and it won't
save.
Thanks in advance!
... more >>
Is an additional index needed if I have a double primary key?
Posted by Viba Fima at 11/28/2003 9:34:50 PM
I have a table with a primary key:
PRIMARY KEY (USERID, ORDERID)
Now I need to search for records with a certain ORDERID. Will the
double-field PRIMARY KEY above support this search, or should I create a new
index for just ORDERID (in addition to keeping the above primary key)?
Thanks,
... more >>
Table Importing
Posted by Satya Rao at 11/28/2003 7:37:12 PM
I am Getting the error when imporing a table from access to Sql Server 2000
Timestamp error. Data Overflow
what could be the problem
... more >>
select into
Posted by Dave Karmens at 11/28/2003 6:04:18 PM
can I perform a select into on one table?
select a, b, c into (d, e, f) from tbl1
where d,e,f are the destination tables?
... more >>
dbo
Posted by I_AM_DON_AND_YOU? at 11/28/2003 5:09:44 PM
Why is that database userid for both sa and master login ids are 'dbo'?
... more >>
debugging sqlserver stored procedure
Posted by sandro72 at 11/28/2003 4:40:43 PM
Hi, i've sqlserver 7.0 with win2k and visual studio.net. i see in Server
Explorer the stored procedure i want to debug. In the project properties i
selected the SQL Server Debugging check box. I've not right problems because
i can run the SP.
MSDN says:
To enable debugging with the SQL 2000... more >>
INSERT SELECT INTO TABLE
Posted by Simon at 11/28/2003 4:35:40 PM
How can I insert the results of select statement into table?
example, which don't work:
insert into zalogeOlap
(select
z.zo_drzava_id,s.izd_id,zo_datum,zo_zaloga_malo,zo_zaloga_vele,zo_pr_mesec,z
o_pr_teden
from zalogeOlap z INNER JOIN izdelek_sestavljen s
ON s.izdS_id=z.zo_izd_id)
Tab... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Small group by problem
Posted by Lasse Edsvik at 11/28/2003 3:21:12 PM
Hello
I have a small problem you guys might fix in notime........
Im trying to get this result:
Date Emp. Sum
2003-11-28 1 50
2003-11-29 1 20
2003-11-30 1 0
2003-11-28 2 10
2003-11-29 2 10
2003-11-30 2 0
Im using this example as a test... more >>
Yukon Ho! - feature request
Posted by Colin Bendell at 11/28/2003 3:18:44 PM
To the Yukon Development team:
I noticed in the yukon beta1 docs that you can now use variables with the
TOP command in a SELECT statement. This is very useful! I would like to
offer one further enhancement to the top command - the ability to specify a
range (ie: select top 10 to 20 username... more >>
fixing non-normalized tables
Posted by Gunnar Kleive at 11/28/2003 3:11:25 PM
Hello!
I am trying to fix a table with repeating groups to get it in compliance
with 1st normal form. I have executed an update operation, but it takes
forever... Can you please tell me if there is a logical mistake in what I'm
doing here?
--update correct table with data from table vio... more >>
Execute Stored Procedure with Default Parameter
Posted by hdsjunk at 11/28/2003 2:51:19 PM
I have this stored procedure:
CREATE PROC sp_Invoice
@Vendor Char (4) = '%'
AS
BEGIN
SELECT dbo.Hdr_InvHeader.Hdr_VdrNbr,
dbo.Hdr_InvHeader.Hdr_InvNbr AS InvNbr FROM
dbo.Hdr_InvHeader WHERE Hdr_VdrNbr LIKE @Vendor
END
RETURN
GO
My understanding is that if I use this statement it wil... more >>
Notify Service?
Posted by ll at 11/28/2003 2:26:31 PM
Hi,
SQL2K has a Notify Service?
Thanks.
... more >>
Sequence numbering and the Microsoft implementation of insert
Posted by kurt sune at 11/28/2003 2:21:06 PM
I have a table like this
create table dbo.Synonyms (
SearchWord varchar(50) not null,
Synonym varchar(50) not null,
Sequence integer not null,
constraint SynonymsPKCO primary key nonclustered (Sequence)
)
go
create unique clus... more >>
optimize table/query
Posted by Edvard Spasojevic at 11/28/2003 2:12:52 PM
We have a table with 100 million rows. Table has all necessary indexes (by
tuning wizard and manually). Following query gives 40 minutes response time:
SELECT datename(month,StartDateTime) + ' ' +
str(datepart(year,StartDateTime)),
COUNT(*) AS 'Count' ,
datepart(year,StartDateTime),
date... more >>
Stored Procedure in a Query
Posted by Tobe Pittman at 11/28/2003 1:28:55 PM
How can I use the result of a stored procedure in a query?
For example, if I have a s.p. that is named 'GetNextKey',
how could I use it in a query like this:
INSERT INTO <tablename>
(ID, ...
VALUES
(GetNextKey(), ...... more >>
Trigger syntax
Posted by leonf00 NO[at]SPAM hotmail.com at 11/28/2003 1:18:08 PM
Hi,
I really don't remember how to do this...
I have a table A = {ColumA, ColumnB, ..., LastUpdated}
I want to create a trigger that will set LastUpdated to Now() whenever
the record is changed.
I know it starts like this:
CREATE TRIGGER UpdateLastUpdated ON [TableA]
FOR UPDATE
AS
[...... more >>
Wanted A Query
Posted by Satya Rao at 11/28/2003 12:14:14 PM
Hai Everybody,
I have a table structure like this. (No Primary key)
Ward | MeterNo | CollectionAmt | CollectionDate
------------------------------------------
01 '10 F' 520 '15/Jan/2003'
01 '10 F' 250 '17/Jul/2003'
01 ... more >>
sql query
Posted by c_dito NO[at]SPAM yahoo.com at 11/28/2003 11:50:48 AM
How do I write a query that obtains the last invoice for each
customer? I can make one that returns the last one by date, but not
the last by date for each cust. All of the records are in one table.... more >>
How to split on record.
Posted by Totto at 11/28/2003 10:29:36 AM
Hi,
I have a program that stores many "records" in on row in SQL Server 2000.
Like this:
ItemID1, Value1, Timestamp1, ItemID2, Value2,Timestamp2, ItemID3,
Value3,Timestamp3, ..... etc...
I would like to run a trigger on the sql server that splits this row into
many records and stores to a dif... more >>
SQL SP - DISTINCT pukes on me
Posted by Gerard at 11/28/2003 9:42:02 AM
I am using SQL Server 2000 on Windows 2000. I have made a
bunch of SP for queries I do alot. But every one that has
the DISTINCT keyword in the SELECT clause bombs. Any
thoughts. Thanks in advance...
Gerard... more >>
How to determine if a foreign key value is in use
Posted by Mike IC at 11/28/2003 9:06:07 AM
I would like to know how to determine if a value in table is being used as a foreign key any place else in the database. I know that attempting to delete that value throws a 'column reference constraint' exception, but I would rather not have to attempt deleting a value to find out whether or not i... more >>
normalizing imported table question
Posted by Scott MacDonald at 11/28/2003 8:53:12 AM
I have a table that I'm importing data into that I need to
move into normalized tables. My instinct is to use
cursors to read each record and perform lookups to get id
numbers for things like city etc. Is this the approach I
should use or can this be done more efficiently with set-
based o... more >>
XP SP
Posted by ovidiu at 11/28/2003 8:53:09 AM
Did anybody create xp using VB? If yes may I have a sample?
Thx... more >>
ADO & Temp Table
Posted by Darren at 11/28/2003 8:44:48 AM
I am trying to create a #TempTable and then query it using ADO.
This was working fine when it was an application, but I have moved this unit
and made it a DLL. Now when I try to query the #temptable, it is already
gone. Even if I try to query it at the end of a batch it says 'Command Text
does n... more >>
Floats, SUM in SQL6.5 and SQL 2000
Posted by Beechams at 11/28/2003 8:26:43 AM
Hello All,
I have a SQL 6.5 database that I am in the process of upgrading to SQL 2000.
The two systems will exist in parallel for a while. I have used a DTS
package to transfer data from the 6.5 server to the 2000 server (all the
table definitions are the same). After running the DTS package ... more >>
Cross Database Trigger
Posted by Greg Vargo at 11/28/2003 8:23:42 AM
How do I create a trigger to insert a new record in a
table that is in a different database?
In database "Company1", when a new record is added to
the "Invoices" table, I want to add a new record
in "Billed" table in the "Company1Apps" database.
I can't get a trigger or a stored procedu... more >>
SQL Query
Posted by Peter Newman at 11/28/2003 6:47:15 AM
I tried this on a different newsgroup with no response,
so i thought i would try here
I have a table containing 6 fields ( Varchars )
I have ceated a query
Select F1, F2, F3, F4, F5, F6, Count(f1) AS TOTALRETURNED
From Table 1
Where (F1 = ' Value' AND F2 = ' Value)
Group By F1, F2, F... more >>
Newbe.. Split question
Posted by ldurland at 11/28/2003 5:01:04 AM
Hi all,
Not sure if possible but I have a stored procedure that filters a view. I have a parameter in the stored procedure that is a comma delimited string. How can I split this parameter to get the correct records from the view?
Here is what I have , note the businessunit is the cds.
CR... more >>
create a cursor from a query in a String
Posted by iltrex NO[at]SPAM libero.it at 11/28/2003 1:31:06 AM
Hello
in a stored procedure I need to create a cursor on a query which code
is generated at run time in a string.
Something like:
----------
declare c cursor
@sql='select * from ' + @TABLE
c=recordset of @sql
-------------
where @table is a parameter.
The only thing I can do by... more >>
Null Field
Posted by Jim Heavey at 11/28/2003 12:21:03 AM
I have a stored procedure which accepts a parm. The parm is defined as
int. There are times when I want to pass nulls in the parm for this field.
When I set my vb Client to pass nulls in the parm, I get an error message
indicating that I have not provided a value for the parm. When I run i... more >>
How to implement RANK function of Oracle
Posted by Amit Pal Singh at 11/28/2003 12:01:05 AM
I am working on a migration project . I want to implement RANK function of Oracle in SQL SERVER.
Can anybody help m
Thanks in advanc
Amit... more >>
|