all groups > sql server programming > july 2003 > threads for tuesday july 22
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
Newbie SQL programming question
Posted by graham at 7/22/2003 11:22:31 PM
Try to write a sql statement that I didn't have any
problem with in Access.
Table: Test
Fields: Rec_Type, Amount
Need to write an "IF" Function that says something like IF
Rec_Type = 1 then Amount else 0
BUT, I can't have the Rec_Type in the Select Statement.
So I tryed,
Select C... more >>
Linked Server & Transactions
Posted by Raja at 7/22/2003 11:03:02 PM
Hi,
I have written a stored procedure in which I am doing
deletions and insertions.
I am also using linked servers.
The problem that I am facing is that the stored procedure
is taking a very long time to execute when I use BEGIN
TRANSACTION and COMMIT TRANSATION statements and I have ... more >>
Is there "subform" in SQL 2000???
Posted by Jhoon at 7/22/2003 10:56:26 PM
I have 3 tables in many to many relationship. Table1,
Table2, Table3.
Table1:
ID: Name: State:
1 User1 CA
2 User2 FL
3 User3 NC
Table2: (many-to-many table)
ID: Name: OptionID:
1 User1 Option1
2 User1 Option2
3 User1 Option3
4 ... more >>
Table name in variables?
Posted by dola NO[at]SPAM webinhk.com at 7/22/2003 7:20:12 PM
Hello, everybody.
I have written the following stored procedure:
create procedure Testing
@tabname varchar(50)
AS
select * from @tabname
and found that it doesn't work. I want to know
if there is any way for me to do the same thing
as the above procedure does. May be this is a
silly q... more >>
View syntax question
Posted by jared NO[at]SPAM hwai.com at 7/22/2003 5:57:43 PM
I am trying to create a view in SQL Server 2000. One field of the
view depends on the value of any of ten fields, i.e., in the base
table that is the source for this view column I need to test which one
of the ten fields has a 'Y' (one of them is guaranteed to).
I can't figure out how to do t... more >>
VBA in Access linked to SQL tables not working
Posted by Gerry O at 7/22/2003 4:07:23 PM
I have an Access database and I moved the tables to a SQL
Server. I am trying to update some records using VBA and
the Addnew and Update commands. When the code is executed
the system locks up. There is no error message.
In my Access front-end, I use similiar code and it is
working. This ... more >>
Create Identity Field
Posted by Stephen Brown at 7/22/2003 3:46:47 PM
I have a need for a custom identity field. NewID() is absolute overkill and
too awkward and @@Identity is far too simple and database specific. I can
easily create a stored procedure to create this, but how would I tie it to
the field? I've been playing around with stored procs, defaults, form... more >>
UPDATE from Two Tables Into One Table
Posted by Jon Spartan at 7/22/2003 2:58:01 PM
I have this problem, which for now is NOT something I have
created, yet. However the problem remains.
We have to UPDATE TABLE A -
TABLES -
TABLE A Columns xCode, yCode, EndValue
TABLE B Columns yCode, EndValue
TABLE C Columns yCode, EndValue
Condtions for UPDATE
IF TABLE A.xC... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Debugger & a firewall
Posted by Angela Henry at 7/22/2003 2:16:05 PM
I am having trouble getting our debugging to work. I have
read through ALL the documentation in BOL on the debugger,
I have scoured over the news groups and found one
interesting thing. Several of the threads mention 'make
sure there's no firewall between the client and the
server' but t... more >>
Help avoid Cursor to calc Correlation
Posted by Jay at 7/22/2003 2:06:51 PM
This is probably a lenghtly post but its mostly data
If you are familiar with correlations - I am essentially trying to create a
correlation matrix.
MyTable
========
Date Symbol Price
===== ====== ======
1/1/99 MSFT 25.00
1/1/99 INTC 21.00
1/1/99 AMD 23.... more >>
Raising error from SPROc in VBS Script
Posted by Andreas Heid at 7/22/2003 1:45:24 PM
Hi all,
I'm calling a SPROC from a vbs file (wsf) and try to raise
an error, i.e. interrupt script execution based on raising
an error in the SPROC.
Here's what I do in the SPROC:
SET @strErrorMessage = 'My Error Message' +char(10)
RAISERROR (@strErrorMessage, 1, 2) WITH SETERROR
ROLLB... more >>
SQL Profiler: why don't i see the parameter values?
Posted by yonision NO[at]SPAM hotmail.com at 7/22/2003 1:19:09 PM
Hi All,
I am trying to trace stored procedure calls with SQL server in the
Profiler tool. Last time i did it i belive i was able to see the
parameter values that i passed in each stored procedure call. now i
just see their names. anybody knows how i can configure the profiler
to show me the par... more >>
Compound SQL query Q
Posted by Justin Dutoit at 7/22/2003 1:12:25 PM
Hey. I need to do this Copy Total operation in one, compound, SQL statement.
I'd appreciate a fix for this attempt:
CREATE PROCEDURE CopyBasketTotal
(
@FromBasketNum int,
@ToBasketNum int
)
AS
UPDATE Baskets
SET
Total = SELECT Total
FROM Baskets
... more >>
one FETCH satement in a WHILE loop
Posted by Rizwan at 7/22/2003 12:53:18 PM
In my Stored Procedure, I want to define a cursor on a table and do
different types of validation. If any validation fails I want to move this
record in a exceptions table and fetch the next record. Else I updates some
tables and fetch the next record. This is a protype :
DECLARE c_emp CURSOR ... more >>
Clustered index on GUID
Posted by Miroo_news at 7/22/2003 12:28:56 PM
Hi
Is it OK when I have primary clustered index on uniqueidentifier field? Does
it make performance better or worse?
Regards
Miroo
... more >>
Single Instance Query
Posted by Hugo Castrillon at 7/22/2003 12:03:28 PM
Hello All,
I have a table containing student #'s and family #'s.
One family # can belong to several students. I need a
list of the first intstance and only the first instance
of family number in the table. I would like a list
of 'DISTINCT' family #'s with a single corresponding
stude... more >>
Need SELECT help. How to make this 2 SELECTs to 1 ??
Posted by Andreas Klemt at 7/22/2003 11:38:33 AM
Hello,
I want to bring two SELECTS to one SELECT. How to do this?
-1-
SELECT userID FROM users WHERE firstname='John'
userID firstname
3 john
-2-
SELECT userID, firstname, xxxxx As marked FROM users
userID firstname marked
1 tim 0
2 mike ... more >>
How to Pick a Random Record?
Posted by Jack at 7/22/2003 11:33:50 AM
Hello,
I'm trying to pick a random record out of a table, with SITEID of many
sites. I would like to be able to get a random record from records with a
SITEID of 1.
Any help would be great!
Thanks,
Jack
... more >>
How use this query better ???
Posted by lubiel at 7/22/2003 11:08:00 AM
Hello,
Someone knows the way of simplify this query:
Table_1
Field1A-Field1B-Field1C
ABC-123-90
ABC-567-90
ABC-890-90
DEF-147-90
DEF-258-90
Select *from Table_2
where
Field2A like 'ABC' and Field2B like '123'
And
Field2A like 'ABC' and Field2B like '567'
And
Field2A l... more >>
dr("field").toString returns "400.0000" instead of "400"
Posted by Dan C Douglas at 7/22/2003 11:03:51 AM
I have just installed VS.NET 2003 on my computer. I have a project that =
I have been developing on VS.NET 2002. I haven't upgraded this project =
to VS.NET 2003 yet and I am still developing it in VS.NET 2002.
When I am putting values from my SQLDataReader into labels and text =
boxes I am ... more >>
Transaction Rollback
Posted by Ketema J. Harris at 7/22/2003 10:52:47 AM
What is the best tool or utility to use to read a DB so that it can be
rolled back to a previous state? I was working on a development project and
accidentally updated a lot of rows and I did not have the SQl statement
inside a Begin...Commit Transaction statement.
Thanks
... more >>
question about sp
Posted by Mike at 7/22/2003 10:52:38 AM
can you tell me if that's possible to do in a store procedure?
I need to while loop i guess.
@app_permissions = '1,1,7,1,0,8,1,0,9, 1,1,10, ......'
UPDATE app_user_permissions
SET value=1,trial_period=1
WHERE "app_id"=7
UPDATE app_user_permissions
SET value=1,trial_period=0
WHE... more >>
Insert trigger sqlserver 2000 and Visma Salesoffice
Posted by kath NO[at]SPAM rosasider.no at 7/22/2003 10:24:03 AM
Hi,
I'm trying to write a trigger that will fire on insert on one database
table and make some changes on another database table.
The Data database with the table Customer has the trigger, and is
supposed to
insert the same data into the Web database.
I've added the correct users to both d... more >>
Bug in Coalesce?
Posted by Jacco Schalkwijk at 7/22/2003 10:08:27 AM
Hi all,
While answering the post for Paolo below I came across the following
unexpected behaviour:
CREATE TABLE Product(productID INT, quantity INT, [date] datetime)
GO
INSERT INTO Product values(1 , 2 , '20030721')
INSERT INTO Product values(1 , 3 , '20030720... more >>
Help with Tricky UPDATE sql statements.
Posted by Lam Nguyen at 7/22/2003 9:51:04 AM
Hi all,
I have 4 rows in a table and I need to update row 3 and 4
to 1 and 2 with a new values and delete row 3 and 4 after
the update
is done. Any help would greatly appreciate. Please look
at me desire result. Once again, Thank you for your help.
drop table #Temp
go
CREATE TAB... more >>
Null in check
Posted by Paolo at 7/22/2003 9:19:20 AM
Hi, if I insert the NULL value in CHECK constraint with IN the SQL generated
don't take in consideration the NULL value.
For example:
ALTER TABLE MyTable ADD CONSTRAINT CkMyTable_CODE CHECK(CODE IN(NULL,
'A','B','C'))
In Enterprise Manager / Table / Check the sql generated by the check don'... more >>
combine two select queries
Posted by jt at 7/22/2003 9:12:15 AM
i have two select queries that take a good amount of time
to run - im wondering if there is a way i could combine
these two selects into one query to enhance performance -
any ideas??
here are the queries:
SELECT @premium_balance = sum(amount) FROM tGLDetail WHERE
contract_id = @contract... more >>
INSERT INTO on NTEXT fields
Posted by Alexander Poltly at 7/22/2003 9:06:21 AM
INSERT INTO Table1 ( [text] )
VALUES ('XXXX\
')
We are finding that SQL Server 2000 strips the backslash
character off of the above query. The problem occurs when
a backslash character is followed by carriage return and
linefeed character in the value of a column whose data
type is nt... more >>
debugging stored procedures
Posted by Ashish Sharma at 7/22/2003 8:37:13 AM
Hi All,
I read some of the posts in the news group about sql debugger, i am
trying
to debug from a remote client, iam loggin in as sa so i dont have permission
problems, the problem is that the execution never stops on the break
points
I understand g duvall had the same problem, any soluti... more >>
Dynamic SQL use of parameter/variable
Posted by Barry at 7/22/2003 8:19:56 AM
Hi,
I have an INT parameter in a sproc. I check it's value and change it to
NULL if it's zero so that I can use ISNULL in my select statement. This
worked well until I needed to convert this whole mess to dynamic SQL.
Now I'm confused as to how to deal with this parameter. (I'm using this
for... more >>
IndentifyingTrigger Type
Posted by Eric at 7/22/2003 8:01:42 AM
Hi,
I don't know if this is possible, but I'd like to know if
there is a way to identify what trigger was fired if I
have a trigger that runs on a UPDATE, DELETE & INSERT
basis. Clarification:
IF DELETED
DO THIS
IF UPDATE
DO THIS
IF INSERTED
DO THIS
TIA,
Eric... more >>
strange (newbie?) problem
Posted by jared NO[at]SPAM hwai.com at 7/22/2003 7:27:19 AM
I have created a simple package in SQL Server 2000 that tries to exec
a stored procedure that uses a temp table. The proc does not run. I
then created a permanent table, which works perfectly. I am
originally from the Sybase world, if you can't tell, and wondered how
one gets around this beha... more >>
stored procedures run through while debugging
Posted by Daniel Walzenbach at 7/22/2003 7:12:24 AM
Does anybody know why I can't debug in the query analyser
(SQL Server 2000)? The stored procedure immediately runs
through and presents me with the result. I have sufficient
rights to execute SP_SDIDEBUG but this doesn't help.
Thank you in advance!
Daniel... more >>
How use UNION with Sum() ???
Posted by lubiel at 7/22/2003 7:03:45 AM
Hello,
Someone knows the way to sum the result of UNION ???
For example, using the below code I get :
OutCalls
-----------
30018
20988
What can I do In order to get this:
OutCalls
-----------
51006
Select
Count(*) AS OutCalls
FROM MyTable
Where
Fecha be... more >>
brain dead. Help needed!
Posted by holysmoke at 7/22/2003 6:52:08 AM
Hi,
I have a problem in grouping the following project
information data,
The data looks like this
TASK Resource Baseline Estimate
Actuals IsTask
Planning 0
Prepare DB Schema Resource X 3 3
1
Prepare Web Layout Resource Y 2 2
1
Coding 0
ASPX Pages Resource X 5 5 1
Web... more >>
|