all groups > sql server programming > august 2003 > threads for wednesday august 13
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
Multiple value parameters
Posted by AJ at 8/13/2003 11:43:22 PM
This is probably an old question, but is it possible to
pass a string of comma separated values in a param to a
stored proc that can then be used in an IN() clause?
Thanks in advance.... more >>
NewBie Question (Request)
Posted by u352142333 NO[at]SPAM spawnkill.ip-mobilphone.net at 8/13/2003 8:54:53 PM
Could someone give two SQL examples that generate
cr reports like the followings:
(1)
Country City count(City)
A AA 3
A AB 2
A AC 5
B BA 3
B BB 1
(2)
Country City countMin City countMed City countMax
A A... more >>
SOS
Posted by shanmuga raja at 8/13/2003 7:51:47 PM
Hey i get this Blaster Virus in my PC...know what it does? it is activated
when you logon to internet and it waits for sometime and comes up with a
message box saying soem error message and giving 60Seconds that the system
will be shutdown...so save your works...i don't know how to prevent it
sp... more >>
is it difficult to call a script from a program??
Posted by Trint Smith at 8/13/2003 7:43:49 PM
This code is something I use from my vb.net program...can I make some of
these in a script with Query Analyzer, save it as a script and then call
it more efficiently from the program since the program has to do it for
the customer?
sqlstr = "BULK INSERT [Mink].[dbo].[TBL_Catalog]" + _
... more >>
Is there a way to print Queries in Color?
Posted by JDP NO[at]SPAM Work at 8/13/2003 7:17:13 PM
I'd really like to replace the color ink in my printer once in a while.
It seems that I only replace the black....
How can I print my queries in color just as they appear in the QA?
TIA
JeffP...
... more >>
What's the right size datatype?
Posted by Jeff Mason at 8/13/2003 6:55:52 PM
Often I'm confronted with a choice as to the size of the datatype of a given column
when designing a database. For the sake of discussion let's say I have a status code
which may take on any number of distinct numeric values. Perhaps there's a
relatively small number of distinct values, so I co... more >>
Combing 2 SQL Statements into 1
Posted by Stuart Shay at 8/13/2003 6:07:13 PM
Hello All
In the Code Below I have 2 SQL Statements is there a way I can combine the
both statements
into 1 so I only have to execute it once
Thanks
Stuart
IF EXISTS (SELECT TABLE_NAME FROM INFORMATION_SCHEMA.VIEWS
WHERE TABLE_NAME = 'VIEW_MyTestItems')
DROP VIEW VIEW_MyTestItems
... more >>
Deleting Database causes Registration error- anyone see this
Posted by mary beth sheridan at 8/13/2003 5:50:09 PM
I had multiple databases attached to a server in the SQL
Server Enterprise Manager Console for W2000, I deleted a
database off of my server and when I did this and went
back to the server to add another db it says "Connection
Failed Check SQLSERVER registration Properties".
Now I cannot ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
SP problem,,,
Posted by Julio Gonzalez at 8/13/2003 5:19:52 PM
Hi All
I have the following stored procedure..
"
CREATE procedure dbo.GetUserLogin
@UserId TUserId,
@Password TPassword,
@URL TURL OUTPUT
-- Returns the URL link of the user, when successfuly logs on
-- INPUT:
-- @UserId - Login name
-- @Password - Pass... more >>
convert string to date in sql server
Posted by Mr. J. at 8/13/2003 4:37:03 PM
Hello,
I have a string of date with the format : yyyy/mm/dd hh:mm:ss.nnnn
I want to convert it to date in the sql query.
Some thing like this :
select convert(datetime, '2003/08/10 23:59:59.9999', 101)
What I get is the date : 10/08/2003, but with hour = 00:00:00 !
Maybe the type is no... more >>
how to script the text file output from stored procedure?
Posted by === Steve L === at 8/13/2003 4:36:00 PM
background: sql7 on NT servers
instead of using dts, is it possible to script the output process from
within a stored procedure? (a sql table to a text file somewhere on the
network, the text file name will be generated on the fly).
can anyone help?
thank you
steve :)
... more >>
return rows when Item not in source data?
Posted by Rich Protzel at 8/13/2003 4:34:04 PM
Hello,
Here is my source data table (tbl1)
Item Month Num
A Jan 3
B Jan 2
C Jan 1
A Jan 6
B Jan 11
C Jan 8
B Feb 4
B Feb 6
A Mar 7
C Mar 9
A Mar 12
If I count this data by Item by month, A and... more >>
Where is <long text> stored?
Posted by Mike at 8/13/2003 4:15:22 PM
I'm trying to insert several large fields in a single row
and have resorted to using 'text' fields due to the 8060
byte constraint. When I query the results in Query
Analyzer, they now display as <long text>. Where is the
actual data being stored? Thanks.... more >>
Help with linked servers
Posted by Sasha at 8/13/2003 4:10:43 PM
I'm using SQL Server 2000. I have two separate servers, SQL1 and SQL2. I
have SQL2 as a linked server in SQL1. I need to update a single field in a
table in SQL1 with values from a result set from SQL2 that combine 3 tables
in SQL2. How can I accomplish this. This is a one time query and would on... more >>
adding a default to an existing column
Posted by Adam J. Schaff at 8/13/2003 3:49:27 PM
Can you add a default to an existing column? If so, then how? I can't find
a way using the alter table statement, short of dropping the column and
recreating it?
... more >>
Setting a value on a subform
Posted by HSalim at 8/13/2003 3:33:21 PM
Hi,
How do I set the value of a field in a subform from the main form?
the field is bound to a column.
Forms!frmShipments.sbfcartons.txtcartonnum = 1
does not work
... more >>
-2147217864: Optimistic concurrency check failed. The row was modified outside of this cursor.
Posted by Grok at 8/13/2003 3:33:11 PM
Using:
MDAC 2.6
SQLOLEDB Provider
Microsoft SQL Server 7.00 - 7.00.1077 (Intel X86)
This is happening when attempting to update a row that is opened with
a Keyset cursor on the client, a VB program.
After reading relevant sections of "SQL Books Online", Wrox Press "ADO
2.6" and "I... more >>
Using a "dynamic top" statement with a cursor
Posted by Flapper at 8/13/2003 3:30:49 PM
Help please,
Have a situation when converting from Oracle SP's to SQL SP's. The old
oracle cursor was roughly as follows
CURSOR cur_rsStock IS
select
*
from
(select StockRowId, CategoryId
from
STOCKDISPOSABLE
where
STOCKDEFID=numDefId
ORDER BY
STOCKROW... more >>
Top N within Group
Posted by Gedas Gudenas at 8/13/2003 3:30:41 PM
Hello,
I am trying to get the TOP 2 highest stock products for a department. I
tried using a combination of Top N and Group by clause and subqueries, but
nothing seems to work. There will be hundreds of departments and over the
million of products, so performance is very crucial. I was thinkin... more >>
opening an sql server table in MS ACCESS
Posted by PVR at 8/13/2003 3:29:56 PM
Can we open an SQL server table in MS ACCESS
if so, please let me know the steps how to open
Thanks in Advance
PVR... more >>
JOIN clause slows things down?
Posted by Wayne Sheffield at 8/13/2003 3:24:55 PM
I have a co-worker that is a supposed to be a long-time SQL guru.
He claims that when you use the JOIN keyword, that this causes the query to
be executed slowly.
Instead, he advocates using the (old) style where the join conditions are
specified in the where clause, with the old =, *= and =* not... more >>
Execution Plan for actuall Query Run
Posted by RKD at 8/13/2003 2:56:21 PM
Execution Plan in threory is SQL Server guessing the %'s taken by each
process's.
Is there anyway of getting the actuall Execution Process %'s after the query
has run ..in the same format as the Execution Plan.
Thx
... more >>
SELECT TOP sub query Stored PROC
Posted by IntraRELY at 8/13/2003 2:52:19 PM
Why do I get invalid sytax, can you not use variables with in the TOP
Clause. Is there a work around.
ALTER PROC sp_depositoriesretreive
@include int,
@exclude int
AS
SELECT TOP @include
depositoryID,
FROM depositories
WHERE depositoryID NOT IN
(SELECT TOP @exclude depositoryID F... more >>
Evil Bug: SP lines not ending in a proper <CR><LF>
Posted by dataspring NO[at]SPAM hotmail.com at 8/13/2003 2:44:20 PM
Earlier today, I almost pulled my hair out trying to determine why a
straightforward T-SQL case ... end clause was not functioning as
expected within a stored procedure.
I pasted the code block to Query Analyzer and simplified it as
follows:
print
case
when 0 = 1 then 0 -- no
when 0 = 0 ... more >>
How do I error check with multiple BULK INSERTs
Posted by Trint Smith at 8/13/2003 2:24:26 PM
I have several tables being loaded at a time by text files using the
BULK INSERT command...How can I do this properly to ensure that
duplicate data that is not being loaded on this execution does not
prevent non-duplicate data from each file to continue to load? Some of
the data in each file, m... more >>
unique constraints with null values
Posted by belgie at 8/13/2003 1:48:28 PM
I read in SQL Server Books Online:
"UNIQUE constraints can be defined on columns that allow null values,
whereas PRIMARY KEY constraints can be defined only on columns that do not
allow null values."
(Creating and Maintaining Databases:UNIQUE Constraints)
When I try to create a unique const... more >>
How to retrieve a sepecific row from a query?
Posted by hb at 8/13/2003 1:45:29 PM
Hi,
I have a query like the following:
SELECT * FROM Book WHERE bookID<=266
This query returns me 189 rows. I know that TOP n
can help me to get top n rows. But I just want a specific
row (for example: 8th row) from this query result without
any other criteria in WHERE clause. In another... more >>
how to tell what users are logged into database
Posted by CyberSpider at 8/13/2003 1:26:47 PM
Is there an easy way to tell what users are logged into a sql database
Is there a way to disconnect them from the database without restarting the
SQL server
Vic Dailey
... more >>
INSERT...EXEC with multiple results sets
Posted by Dennis S. at 8/13/2003 12:53:35 PM
This may be a silly question, but I'm pretty much a newbie, and I'm stumped.
I'm writing a stored procedure which makes use of one of the system stored
procedures (sp_helplogins). That system stored procedure returns multiple
results sets--two, specifically, and I need to be able to access jus... more >>
Acquiring an accurate recordcount.
Posted by Don at 8/13/2003 12:37:41 PM
I am using an Access Project using SQL Server 2000 and am
having a difficult time getting accurate record counts of
large recordsets (over 1000 records). I use the following
script to populate a caption on a form but for those large
recordsets the count displayed varies.
Public Sub prcPos... more >>
Select using a string array
Posted by J at 8/13/2003 12:26:15 PM
IS there a way for me to have something that if I pass a comma-delimetered
string (for example 1234,5678,12,67,23,90,19) then I can seperate the values
between the commas and retrieve information based on each of those numbers.
For example, if I have at present...
Create Procedure Test
@t... more >>
Gurus... I Need Your Help !
Posted by Carlos Lee at 8/13/2003 11:26:03 AM
ENGLISH:
Hello, I Hope somebody may Help Me.
I have an application, where I have a Parent table and many child tables.
The Problem I have is that I need to make validations over tables that may
be configured by a table, where I specify Table, Field and Criteria that I
must validate.
I thing th... more >>
@@ROWCOUNT
Posted by IntraRELY at 8/13/2003 11:18:54 AM
Hello All,
I need to return a value from a stored proc. similar to
CREATE PROC
AS
SELECT * FROM accounts
RETURN SELECT @@ROWCOUNT
GO
I am getting a 0 as the return value in my application. What am I doing
wrong.
TIA,
Steve Wofford
www.IntraRELY.com
... more >>
stored procedures
Posted by univ0 NO[at]SPAM op.pl at 8/13/2003 11:13:26 AM
Hi,
is there any generic way to anumerate all stored procedures in the database
(ms sql or oracle or any other supporting stored procedure) ?
thanks for help
x
... more >>
Help with table variables please
Posted by Adrian at 8/13/2003 11:03:41 AM
SQL Server 2000
I am trying to use table variables, but . . .
This works:
======
Declare @TempTable Table ([ColA] [varchar] (50) COLLATE
SQL_Latin1_General_CP1_CI_AS NULL )
Insert into @TempTable select * from ThisIsMyTable
======
However I want to be pass the name of 'ThisIsMyTable t... more >>
How to return just one row using SELECT MAX ()
Posted by Polaris at 8/13/2003 11:01:52 AM
Hi :
I'm using select max () to get the maximun row. But sometime it returns
multiple rows when a few rows are the same and are the max. Is there a way
to return just one row in this case? I only need one row returned even there
are multiple rows might be all the max.
Thanks for your help!
... more >>
Access Upsize to SQL Query Problem
Posted by Brian at 8/13/2003 10:54:49 AM
I've been called upon to upsize a fairly basic Access
Database to SQL so we can integrate the data with our SQL
based CRM. We need to leave the front end intact so I
chose to convert to an ADP. I've managed to get all the
tables over and a fair amount of the forms, reports and
querries. ... more >>
pass sql statement to store procedure
Posted by Vitamin at 8/13/2003 10:33:56 AM
Hi All,
Is that I can pass a SQL statement from ASP to Stored Procedure?
If I can, how can I run that SQL statement in stored procedure?
Thx~
... more >>
How many times has a UDF been called?
Posted by Arthur Hoornweg at 8/13/2003 10:26:06 AM
Hi everybody,
I'm looking for an easy way to find out how many times a
user-defined function has been called. That's not trivial,
because a UDF is not allowed to create any objects so
I can't just let the UDF write into a table.
--
Arthur Hoornweg
(please remove the ".net" from my ... more >>
debugger issue
Posted by JohnB at 8/13/2003 10:18:23 AM
Ok, this may be my stupidity, but I'm having trouble with using the debugger
in query analyzer to step through any procedure. It will not stop at break
points and will not allow me to add or view locals. In the past, I've just
used print statements at various points in the code but I would like... more >>
Newbie date convertion question
Posted by Sandip at 8/13/2003 9:53:10 AM
I need to convert a string/character field into a date
field. The string/character field is in the following
format:
20010525
and i need to convert this into a date field, ideally
smalldatetime data type. I can convert the
string/character field into a numeric field if that make
th... more >>
IPS Sendero
Posted by gthmpsn NO[at]SPAM hotmail.com at 8/13/2003 8:35:00 AM
Does anyone know of a connection or interface for Sendero A/L either for SQL or VB?
Glen Thompson... more >>
Using Variables in T-SQL
Posted by Jay Williams at 8/13/2003 8:28:05 AM
I want to take the return value from a stored proc call,
store it in a variable and use that variable as a
parameter in a call to another stored proc. Here is the
code:
declare @QueryID int
exec @QueryID = AddQuery 1, 1, 'Phone_Actual.psq'
exec AddQueryString @QueryID, '\Applications\Ph... more >>
one table - no dups in one column
Posted by meh47960 NO[at]SPAM yahoo.com at 8/13/2003 8:14:24 AM
Hope I can word this right.. One table contains multiple columns with
a column(itemid) that contains duplicates.
How can I return all columns and rows with the exception of rows with
distinct on just column(itemid).
ie.
master table
itemid descript retail size
808 tshirt 9... more >>
INNER JOIN statements. Totaly illogical?
Posted by BeltaneTheShaman at 8/13/2003 6:21:02 AM
Okay, so here's the problem. I'm writing a standard Access
2000
database (*.mdb) within a network environment that lacks
centralised
SQL support.
I've got a Table mounted on a server. The data contained
within this
table is continually updated, by email, from a variety of
locations.
At ... more >>
how to keep sum() from rounding
Posted by Robert at 8/13/2003 6:10:08 AM
The first statement rounds to two decimal places, if I
remove the sum ( after the union)
(second statement) NO rounding occurs. Anyone know of a
way to keep it from rounding and still sum the number?
/////////////////////////////////////////////
SELECT sum((calls.rated_toll_cost +
... more >>
shrink database
Posted by brian at 8/13/2003 6:04:49 AM
Is there any disadvantages of shrinking the database log
file. I remove the inactive portions of my log but
sometimes the log grows to be 10 times the size of my
databse.
Somone once told me that using DBBC Shrink is not a good
idea because it can cause problems thorughout the log and ... more >>
Checking differencies in two tables
Posted by mmmc_reptail NO[at]SPAM hotmail.com at 8/13/2003 6:00:56 AM
Hi,
I need to check two tables for differencies.
I've asked this before and got advice to use stored procedure which
can be found from following address:
http://www.sql-server-performance.com/vg_database_comparison_sp.asp
That seems like the thing I need but I'm just a bit lost as to how
... more >>
question with Highest occurrences
Posted by u352142333 NO[at]SPAM spawnkill.ip-mobilphone.net at 8/13/2003 5:45:11 AM
Have a table:
1 = Good , 2 = mild and 3 = Bad
Country city weather
A AB 1
A CD 2
A EF 3
B AABB 1
And So on.
Need for each country, the 1st and 2nd highest %Good
weather City. sql or crystal report way.
--
Sent by msg_... more >>
Efficient Select Statement
Posted by sweetsell at 8/13/2003 4:57:01 AM
Hi,
Consider the following scenario.
Items table is having 5 columns with 1 million records.
* ItemId (PK)
* ItemName
* ReorderLevel
* ManufId
* CreatedDate
If i want to query the Item table for knowing the
ReorderLevel of all items, it can done in following 2 ways:
SELECT * FRO... more >>
Should I use DML or Cursor to do this update ?
Posted by Krist Lioe at 8/13/2003 4:23:58 AM
Hi SQL Gurus,
I have Order, Invoice and Document Reference tables like attached below.
From 3 Order Documents I want to create 3 Invoices, BUT the Invoice
Number should Start from 51.
(I should read the DocRef Table and get the last number = 50, so the
Invoice should start with 51)
How can I... more >>
switching between IN and NOT IN statements
Posted by carlton at 8/13/2003 1:39:07 AM
example
SELECT field
FROM table
WHERE field2 IN (SELECT field3 FROM table2..etc
i would like to alternate between th "IN" and "NOT IN"
statement in the above based on the result of another
field in another table
can anyone help please
regards Carlton... more >>
CASCADE Delete causing Wrong Trigger Update
Posted by Krist Lioe at 8/13/2003 1:23:44 AM
Hi SQL Gurus,
I have Header-Detail ORDER Tables (Detail Has FK reference to Header,
Cascade Delete).
Detail has After Trigger that updates Stock Availibility (ADD/SUBTRACT)
to Stock Table.
The PROBLEM is :
If I delete More Than One Header (> 1 header rows), it seems Detail
Trigger Does N... more >>
|