all groups > sql server programming > november 2005 > threads for monday 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
BatchOptimistic
Posted by SharkSpeed at 11/28/2005 11:38:13 PM
Hi everybody,
I want to read dataset records from other dataset before updatebatch
process. Is this possible ??? If this is possible how can i do ???
-- all DataSets locktype is BatchOptimistic
Thanks for advise
... more >>
Need help with a query
Posted by ajmister at 11/28/2005 11:00:10 PM
Hi
I have two tables
create table product
(product_id char (4),
product_name char (36),
price float
)
insert into product ('1234','trouser',175.00)
insert into product ('2346','shirt',75.00)
insert into product ('7989','milk',3.00)
insert into product... more >>
Inserting into a time based table
Posted by James Carters at 11/28/2005 8:18:34 PM
This is hurting my head. I have a table showing the historical status of
refineries. They can only be open or closed and the period covered is from
1977 to still open (null)
What I need to do is write a procedure that will insert into the table and
will adjust any overlapping dates.
eg
1977<--... more >>
Re: Update requires a valid UpdateCommand when passed DataRow collecti
Posted by 通过IE æµè§ˆCube at 11/28/2005 6:36:09 PM
I am a new programmer of SQL server 2000 via vb.net. When I change something
in datagrid, the above error takes place. The program is list as follwoing:
Does anybody could help me? Thanks a lot.
cn = New SqlConnection( _
"Server=TEST; database=TEST; UID=sa; pwd=test")
strSQ... more >>
Simple Trigger Question..
Posted by Islamegy® at 11/28/2005 4:58:41 PM
I want to insert LastModify Date after insert or update..
Here is the trigger for insert:
-------------------------------
CREATE TRIGGER [MODIFYDATE] ON [dbo].[AH_SubMaster]
FOR INSERT
AS
Update [AH_SubMaster] Set [LastModify] = GetDate() Where
Master_ID = (Select Master_ID From ins... more >>
Grouping by daterange
Posted by Casey at 11/28/2005 4:44:02 PM
Okay. I have this dataset, looks like this:
propnum rundate genregroup totalcharges
----------- --------------------------------------- ---------- ------------
16 2005-05-27 00:00:00.000 A 131.8800
16 2005-05-27 00:... more >>
Stored Procedure Automation Problem
Posted by Dazza at 11/28/2005 4:34:08 PM
I have created a stored procedure that reads e-mails sent by users and
carries out the relevant actions dependant on the Subject line.
Within the procedure I call upon xp_readnextmsg, xp_readmail and
xp_deletemail using the prefix of master.dbo.
The problem I have is that if I run the proc... more >>
Maintaining a Date/Time Last Updated Value
Posted by Jeff at 11/28/2005 4:06:43 PM
Using SQL Server 2000...
In support of a Web site's product catalogs; we will have at least two
tables [Products] and [ProductCatalogs].
The application needs to show the Date/Time any given product catalog was
last updated. For purposes of this "last updated date/time" value, we
conside... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Best practice for remote queries
Posted by richhollis NO[at]SPAM gmail.com at 11/28/2005 3:16:28 PM
Hi
Would it still be currently regarded as best practice to use OPENQUERY
to run remote queries?
Regards
Richard
... more >>
An INSERT EXEC statement cannot be nested.
Posted by Abhishek Pandey at 11/28/2005 2:26:02 PM
i wanted to store the output of my store proc in a temp table and i wsa doind
this:
INSERT #temp EXEC sproc
and it turned out i cannot do this if my sproc has another insert...exec
thing going on within it.
Is there any way i can store the output of my sproc somehow ?
thanks in advan... more >>
Urgent: SQL Help
Posted by Kirsten at 11/28/2005 2:16:52 PM
I'm stucked in a SQL query. I have:
TableA (KEY_A, Name)
TableB (KEY_B, Name)
TableC (KEY_A, KEY_B)
I need a query to display:
KEY_A KEY_B Is_in_C
---------------------------------------
A1 B1 YES
A2 B1 NO
whe... more >>
Dynamic calculation
Posted by Moshe Allen at 11/28/2005 1:58:17 PM
Hi,
I get different values and a calculation from a query and need to bring them
all together to make another calculation.
@PRICE,@TIME,@CALC,@TOTAL
@PRICE = 3
@TIME = 5
@CALC = '* .5'
@TOTAL = (@PRICE @CALC) * @TIME
I tried to use the exec command, but couldn't get it to work
How can I do... more >>
Column Alias Behavior
Posted by Mike Labosh at 11/28/2005 1:37:52 PM
I don't know why I never noticed this before, but in the code below, why can
I ORDER BY an aliased column, but I have to use the *actual* column name or
expression in the GROUP BY?
I would really rather say "GROUP BY Column1, Column2"
CREATE TABLE msl_T1 (
col1 INT,
col2 INT,
col3 IN... more >>
Top 'n' within a group
Posted by chrisvaf NO[at]SPAM gmail.com at 11/28/2005 1:02:51 PM
I have 2 tables - student and student_exam. Each student takes 5
exams, and I want to return the sum of the exam scores by student,
counting only the top 3 per student. Using the example below, my
desired results are as follows:
Student B 246
Student A 236
I have tried countless SQL stat... more >>
query a sorted view by rows
Posted by Sam at 11/28/2005 12:06:57 PM
how can I query a sorted view by rows - show rows 50 to 75
or show last 25 rows ?
thanks
... more >>
multiple parent categories
Posted by Howard at 11/28/2005 12:03:01 PM
how would you design a table that allows an item to belong to multiple
parent categories.
single parent example:
select * from table1 where parentid = 5
in this case parentid is an indexable unique integer
possible multiple parent:
select * from table1 where parentid = '5,6'
a problem is... more >>
insert a random password
Posted by culam at 11/28/2005 11:51:03 AM
Hi,
I have a random password stored procedure, I need to update all the contacts
without a password with a new random password. I need help on my update
statement. My update statement below contain the EXEC command, therefore it
failed. Please help.
Thanks,
Culam
CREATE PROC dbo.usp... more >>
> Date
Posted by Antonio at 11/28/2005 11:26:05 AM
Hello, everybody,
Can somebody tell me how I can query a field that has a date >1/1/2000?
I don't want to be specific using a BETWEEN clause.
Thanks,
Antonio... more >>
xml and sql
Posted by JFB at 11/28/2005 11:21:11 AM
Hi All,
I have an xml file with a lot of structure and I want to import each part
into a field.
How can I do this taks?
Here is sample of xml structure
<?xml version=""1.0""?>
<FieldTitle1>
<Request>
<Reference>
<Customer>ABC</Customer>
<XpciVersion>1.0001</Xpc... more >>
Qry with "OR" keyword assistance...
Posted by JDP NO[at]SPAM Work at 11/28/2005 11:19:30 AM
Is there a better more reliable or eaiser way to get what I'm looking for?
I want anything that was created after Jan. 1, 2003 that was declined, the
declined letter codes are as indicated, and created after Jan 1, 2003
Or, I want anything that was rated and created after Jan 1, 2003
Or, I... more >>
Count Varchar
Posted by Lontae Jones at 11/28/2005 11:18:02 AM
How can I count the amount of characters in a column that is varchar and how
much space do I have left?... more >>
sql - comparing dates when there is a NULL
Posted by Mike at 11/28/2005 11:10:04 AM
I am joining 2 tables and I would like to return records whose xdate >
getdate() and xdate = null. My query below works but I was wondering if I
could use a better way? like IsNull ?
select name,department from table1 join table2 on table1.id = table2.id and
active=1 and (xdate is null or x... more >>
Stored Procedures and Return Codes...
Posted by Grant Smith at 11/28/2005 10:10:23 AM
OK... So I wrote the following stored procedure and it runs just fine
but I can't seem to get the job to fail on a return of 1. Any ideas?
CREATE PROCEDURE [dbo].[gs_VerifyImportLite]
AS
DECLARE @timeCheck datetime
SET @timeCheck = DateAdd(hour, -1, GetDate())
if exists... more >>
CLR Return Types
Posted by KMP at 11/28/2005 9:46:10 AM
I would like my C# dll to return a float (value) so that I can use that
value within the SQL Server stored procedure. There seems to be a limitation
on the return types from CLR (CLR methods return either SqlInt32,
System.Int32, void.)
I would appreciate if anyone can suggest a workaroun... more >>
Group by issue for a cross tab report
Posted by __Stephen at 11/28/2005 9:22:46 AM
I had a "fine" report for current year revenue, but of course that's not
good enough :)
I was asked to bring in 2 more columns of last year revenue and year before
that.
Yr2003, Yr2004, 2005-1, 2005-2,.. 2005-12, Yr2005
I did a union for the prior year(s) data as well as the total for c... more >>
Fastest way to convert scripts to use Linked Server?
Posted by Rodusa at 11/28/2005 9:19:37 AM
We recently migrated one of our databases to a new server and now we
have to manually modify all of our T-SQL scripts to use Fully qualified
Linked Server Name in order to reference the new database on the new
server. The problem is that this is a very slow update process because
we have to be v... more >>
DELETING ROW DATA
Posted by TS at 11/28/2005 9:19:05 AM
Hi all,
How to delete one row of data from a table?
--
TS... more >>
Writing code to do a dynamic insert
Posted by RSH at 11/28/2005 9:08:37 AM
I have a situation where I am using Service Broker that sends an XML payload
upon a DML action. On the recipient server I am consuming the XML payload
and processing the request (please don't tell me this is what replication
does...there are several reasons we need to use this method over
r... more >>
Creating Schema
Posted by Bahman at 11/28/2005 9:06:03 AM
Hello!
In a doctor-patient table relationship, I need the patient to only have one
doctor but the doctor can have as many patients as he wants.
What is the easiest way to set this up?
Thank you!
... more >>
Changing Column Name
Posted by TS at 11/28/2005 9:06:03 AM
Is there a way to change a column name in one of the tables? Say from XX to
YY. What's the syntax for that?
--
TS... more >>
datediff
Posted by Jaime Lucci at 11/28/2005 9:04:32 AM
Hi everyone!
What's the difference between day and dayofyear in the datediff function?
Thanks.
Jaime Lucci
... more >>
Select Query-Urgent
Posted by Pogas at 11/28/2005 7:52:09 AM
Dear all,
I have a single table, and have records for two toolkits - one for the
actual scorecard with TOOLKITID =105 and a weighting scorecard with a
TOOLKITID=104
RESULTS is the actual entries for the scores for both toolkits.For a
particular actual scorecard abd weigting scorecard, the... more >>
How to Job on Remote Server
Posted by Mark at 11/28/2005 7:23:04 AM
Environment: SQL 2000 Sp4.
I have a SQL job (Same Name) on two servers and based on some criteria, I
want to run the job on one of these servers from a third server. Any
sugestions on how to do it...
Thanks in Advance.
... more >>
DTS Error checking
Posted by Patrice at 11/28/2005 7:23:03 AM
Hello,
What would be good syntax to add to a DTS package to make sure that all of
the records from a live system made it into a warehouse table? Would it be
as simple as a COUNT(*) - and if so, how would I use that to notify or fail
if all of the records do not make it into the warehouse?
... more >>
How to write script Update defaults
Posted by nywebmaster at 11/28/2005 4:51:03 AM
I have table TABLE1 with 101 columns
ID - int
Notes1 char
Notes2 char
Notes3 char
Notes4 char
Notes5 char
Notes6 char
Notes7 char
Notes8 char
Notes9 char
Notes10 char
....
Notes100 char
I want to SET defaults values for all NotesX columns to "EMPTY"
How to write scripts for that.
... more >>
CASE Syntax
Posted by marcmc at 11/28/2005 3:07:03 AM
Hi, I want add an additional filter to the following CASE statement and using
NUM_VEH on Line 7 'determine when the product type is QMV and number of seats
is greater than 4 then assign PRODUCT_TYPE value = 2'. What is the right
syntax to do so?
SELECT product_group = CASE WHEN PO_RSK_ITEM ... more >>
Inner / Outer Cursors
Posted by Anthony Robinson at 11/28/2005 1:38:06 AM
I have a piece of SQL that is giving me a bit of trouble. This piece of =
code uses inner and outer cursors.
Here's the chunk:
--APPLY PRIVACY SETTINGS
DECLARE PRIVACY_CURSOR CURSOR FOR
SELECT DISTINCT USERID=20
FROM #USERS
=20
OPEN PRIVACY_CURSOR
FETCH NEXT FROM PRIVACY_CURSOR
INTO ... more >>
Help with a Stored Procedure..
Posted by Chris Ashley at 11/28/2005 1:14:06 AM
Can anybody help me with this stored procedure? Basically I need to do
something like do:
Total = Premium + (WHEN AddOn1 != -1) + (WHEN AddOn2 != -1) + (WHEN
AddOn3 != -1)
To clarify, the value 'Total' needs to consist of a field called
'Premium' plus the AddOn1, AddOn2, AddOn3 IF they are ... more >>
Ranking of search results
Posted by GregO at 11/28/2005 12:00:00 AM
Hi,
I have a simple web application. It has a search feature which searchs the
database for matches document based on what the user enters. The query just
does a select ... where document like '%userinput%' . Document is just a
text column.
I want ot rank the results based on relevants... more >>
Naming checkboxes
Posted by bg-consult as, Leif Hauge at 11/28/2005 12:00:00 AM
Hi !
I am programming in ASP against a SQL database, and have a little question I
hope to get some help on here :
I retrieve data about products to my .ASP page, with checkboxes if a product
is active or not. The problem is to automatically name these checkboxes
seperately, so it belongs to... more >>
Combine 2 tables
Posted by Tony WONG at 11/28/2005 12:00:00 AM
i have 2 tables in a database
one is recording all the fax-in to users, the another is recording all the
fax-out by users.
i wish to combine the tables (by JOIN?) so that the users can see its own
fax-in and fax-out.
After the join, then the new look is TableA.date, TableB.date in 2 colum... more >>
Searching Field Name and Value in Database
Posted by Ankit Gurjar at 11/28/2005 12:00:00 AM
Hello,
I would like to search one Key ( field ) and value in every tables of
my Database. And i would like to get the List of the Tables and related
rows.
eg. I would like to search for intUserID and value = #value# in my
Database ( every table ).
Is there any method to ... more >>
|