all groups > sql server programming > september 2003 > threads for monday september 29
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
script to drop indexes
Posted by simo at 9/29/2003 10:57:31 PM
Hi,
I'm looking for a script or suggestions on how I can go about sql scripting
the dropping of any primary keys (be they constraints or indexes) and/or
clustered indexes for a particular table.
I would like to create a proc and just pass it a table name and will require
this to work on SQL7 & ... more >>
Supress Repeating values in a column
Posted by Anupam Mondal at 9/29/2003 10:02:28 PM
Hi all,
This is what I have in a table...
Testcol1 Testcol2
-------- --------------------
1 5
1 a
1 k
1 R
2 b
2 L
2 O
2 P
2 Z
3 c
3 G
3 O
3 R
3 Z
4 C
4 d... more >>
Message no longer availilble
Posted by BJ Freeman at 9/29/2003 7:29:13 PM
Is it just me, or are messages being deleted.
I click on + and get Message is no longer available on the server
... more >>
Relationships problem
Posted by Roy Goldhammer at 9/29/2003 7:29:04 PM
Hello there
I've tried to force Update and delete Cascade on one of the relationships.
This is the error i got:
Introducing FOREIGN KEY constraint 'FK_LongData_Companies' on table
'LongData' may cause cycles or multiple cascade paths. Specify ON DELETE NO
ACTION or ON UPDATE NO ACTION, or m... more >>
Desktop Distributable
Posted by Miles Kuwata at 9/29/2003 6:39:35 PM
My question is how do I or where can I find information on
how to create and distribute Desktop Distributable
software. My company is just now getting into SQL and we
have clients all types of Clients. Ones that have a full
IT department and others that what the features of SQL but
do not ... more >>
DTS hanging
Posted by vcv at 9/29/2003 6:18:05 PM
Why is it that there are times when during a dts
extraction of sybase data from another server, it shows
that it continually is loading records, millions and keeps
going on and on ... until you cancel it? We read about
this before in a technical article about flaws of the
dts. Is there a... more >>
Add Column and Update new column with Random number
Posted by Gerry Viator at 9/29/2003 5:05:24 PM
Hi all,
for some reason the first post disappeared, sorry for reposting this
I need to do two things one create a new column called [newERCPid =
]
and two generate a unique random numeric number using ercpid =
column
[ ercpid =3D a identity column incremented by 1 ]
... more >>
Sql Query Select Case
Posted by Phoebe. at 9/29/2003 5:00:41 PM
Hi, Good Day!
May I know what's wrong with the below sql query
SELECT Amount=CASE WHEN=:sSelection='D' THEN 'D_Commission'
CASE WHEN=:sSelection='R' THEN 'R_Commission'
CASE WHEN=:sSelection='M' THEN 'M_Commission'
CASE ELSE=:sSelection='G' THEN 'G_Commission' END,
Error message said tha... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Please help....
Posted by Vitamin at 9/29/2003 5:00:38 PM
I am using asp to connect to my MS SQL Server, there have some problems,
could you please help me?
1. take about 5 seconds to make a connection with SQL server:
In other projects, this would not happen, it just happened in my
project? Why?
2. Select MAX() problem
I need using selec... more >>
select * from Categories limit 0,5
Posted by whidy at 9/29/2003 4:57:52 PM
use Northwind
select * from Categories limit 0,5
why the statement cann't be executed?
... more >>
Multiple conditions in sql statement
Posted by Ugo at 9/29/2003 4:54:40 PM
Can anyone help?
I have a the following sql statment:
Select StoreID,TransactionDetailDate,RegisterID,TransactionNo,CashierNo,
SKUUPC,
Quantity,ExtendedSellingPrice, ExtendedOriginalPrice,
(ABS(ExtendedOriginalPrice)-ABS(ExtendedSellingPrice))/ABS(ExtendedOriginalP
rice)*100 Discount
... more >>
Add Column and Update new Column with Random number
Posted by Gerry Viator at 9/29/2003 4:45:37 PM
Hi all,
I need to do two things one create a new column called [newERCPid =
]
and two generate a unique random numeric number using ercpid =
column
[ ercpid =3D a identity column incremented by 1 ]
I would later need to be able to reverse using the same algorithm =
... more >>
Best way to format Date in SQL string
Posted by Alex Stevens at 9/29/2003 4:41:38 PM
Hi,
I'm constructing an SQL string which has a date comparison in the criteria:
I.e
DateStarted=08/08/2003
What is the best way to format the date string so that SQL interprets it
correctly in British Time? (8th August 20003).
Should I always enclose the date in hashes? #08/08/2003#
a... more >>
srv_rpcdb and SQL Server 2000
Posted by Gavin Landon at 9/29/2003 4:17:41 PM
Why did Microsoft pull out the functionality of srv_rpcdb from SQL Server
2000? That is something I need very badly right now and it's no longer
supported..
... more >>
Trigger Problem
Posted by Toby Donovan at 9/29/2003 4:08:35 PM
I am attempting to create a Insert/Update/Delete trigger
where it updates a table on a linked server. The trigger
code below works in SQL Analyzer but when the application
tries to do the insert in the first table I get the error
message
[Microsoft][ODBC SQL Server Driver][SQL Server]
... more >>
Selecting the id field from multiple ranges
Posted by Jim Mesara at 9/29/2003 4:01:45 PM
I have the following situation. A user can enter multiple ranges of numbers
like so:
Range1: 123-125
Range2: 126-130
Here is my database structure:
ID First_Number Second_Number
111 123 125
112 126 130
I need a query that will ret... more >>
Bulk Insert error checking
Posted by kob uki at 9/29/2003 4:01:05 PM
I am trying to import perflog output files into a database and then later
analyze it. I am using bulk insert for the import. At the 12th file I got
this error:
Importing file server_20030924.tsv
Server: Msg 4832, Level 16, State 1, Line 1
Bulk Insert: Unexpected end-of-file (EOF) encountered... more >>
Change Collation
Posted by Vincent at 9/29/2003 3:54:52 PM
I'd created a database in SQL_Latin1_General_CP1_CI_AS.
Now I want to store data in another language.
Therefore I created a table and the columns are set to
"Chinese_Taiwan_Stroke_CI_AI" Collation.
However, when I insert data to the table,
the records are "???"
Can anyone help me?
Thanks
... more >>
Query Help
Posted by John Bonds at 9/29/2003 3:50:59 PM
Table Schema:
CREATE TABLE PaperType
PaperTypeID INT PRIMARY KEY
Description VARCHAR(25)
CREATE TABLE Scanned
CustomerID INT PRIMARY KEY
PaperTypeID INT PRIMARY KEY (FK Relation to PaperType.PaperTypeID)
Ok, let's say that there's 3 rows in the PaperType table. I want to s... more >>
Simple Search Query with Wildcards
Posted by John at 9/29/2003 2:49:55 PM
Hi All,
I want to implement one stored procedure which will be
used to search a database on many fields. My problem is
that I can not figure out how to properly use wildcards on
the in parameters. The way I do it now is by setting the
default value of the parameters to '%' and then I use... more >>
SQL HELP
Posted by Appu at 9/29/2003 2:43:46 PM
I want an UPDATE statement which updates column 'amt' in
table EMP, Here are the table schema and sample data
TABLE EMP
eid depcode amt
100 A 500
100 B 300
101 A 1000
101 B 1200
102 A 2000
102 B 2400
103 A 4000
103 B 4200
TABLE SP_EMP
eid depcode amt
100 J 400
100 J 300
102 ... more >>
Help in UDF
Posted by Hari at 9/29/2003 2:19:34 PM
Hi Guys,
Will we be able to execute a function using Linked server. Say I have a
function in B_SERVER
CREATE FUNCTION DummyInt1()
RETURNS INT
AS
BEGIN
RETURN(-1)
END
My requirement is that I need to execute this function from A_SERVER
select B_SERVER.DBNAME.dbo.dummyint1()
... more >>
How can I write this query...
Posted by fabriZio at 9/29/2003 2:14:43 PM
I have a table 'x' and I would like to ltrim rtrim (there are some spaces)
all column without do this manually.
Is there something similar sp_msforeachTable ?
Any help appreciated.
Regards
--
==
fabriZio
... more >>
Query Help.
Posted by Ricky at 9/29/2003 2:09:50 PM
Hi All
I have 2 tables:
Table1
PriKey FK Key Datetime Description
1 2 2248 2003-01-01 00:00:00 XYZ
2 2 2249 2003-01-03 00:00:00 X1Y1Z1
3 2 2257 2003-01-04 00:00:00 X2Y2Z2
4 6 2235 2003-01-01... more >>
Putting sp results into a temporary table.
Posted by Justin Crossley at 9/29/2003 2:09:11 PM
Is there any way of putting the result set from an sp into a temporary
table.
What I need is something like
insert into ##MyTable exec select * from MyStoredProcedure
but this is not allowed.
Any ideas?
Thanks
Justin Crossley
... more >>
xp_cmdshell Execution Error
Posted by njain NO[at]SPAM hewsongroup.com at 9/29/2003 2:02:42 PM
When execute the following command in SQL Server 2000 query analyzer
Command:
EXEC xp_cmdshell 'dir c:\*.*'
I get the following erorr:
ODBC: Msg 0, Level 16, State 1
Cannot load the DLL xplog7O.dll, or one of the DLLs it references.
Reason: 126(The specified module could not be found.).... more >>
Simple JOIN question
Posted by sfrattura at 9/29/2003 2:01:41 PM
I know I can join two tables with INNER JOIN, getting all the rows that are
in BOTH tables.
How can I do a join and see what rows from table A DO NOT EXIST in table B?
(I am trying to avoid the syntax "...where not exists(<inner join
subquery>)"
Thanks
Sandro Frattura
... more >>
QueryAnalyzer Intelisense like Add-On
Posted by yaniv at 9/29/2003 1:58:34 PM
http://www.key-hole.com/EZSql/... more >>
Counting Data towards MAX(Datetime)
Posted by Joshi at 9/29/2003 1:41:26 PM
Hello folks,
I am trying to count the last Person seem by a customer
against a max(VisitDate) and max(DataEntryDate) but am
unable to do so because the Customer can see multiple
providers and the grouping on max(Datetime) fields does
not seem to do the trick.
The results are as follo... more >>
LIKE Patten
Posted by Wes Jackson at 9/29/2003 1:40:32 PM
I would like to use a returned columns data as my LIKE patten but find thats
its not interpreting the wildcards etc.
Any ideas how this could be done?
ie
@@CardNo numeric
AS
SELECT * FROM Cards
WHERE
CardNo = @@CardNo and @@CardNo LIKE Mask
(Mask returns '____________99%')
... more >>
HELP: Finding index names in sysindexes using a column name
Posted by DG at 9/29/2003 1:39:10 PM
Hello and thanks in advance!!!
I need to find the name(s) of any index(es) which are on a column by using
the sysindexes table.
For example (psuedo SQL here....)
Select index_name from sysindexes where table_name = 'my_table' and
column_name = 'column_1'
etc...
Thanks....
... more >>
how to upload files to sql table
Posted by muhamad kassem at 9/29/2003 1:27:13 PM
hi
how to upload files to sql table
during query , Stored Procedures or C# program
... more >>
created an concatonate string from multiple records proceedure
Posted by BJ Freeman at 9/29/2003 1:12:15 PM
Ok I am in over my head.
I created a stored proceedure I have included below.
I want to make one string to return to the caller.
I thought this would do it.
Select @lclStr=@lclStr+', '+@OrderString+','+ CAST(@Quantity as
varchar(10))
No Dice. any suggestions
this
PRINT 'qty: ' + CAST(@Q... more >>
Calculating bytes used for a column
Posted by Dave at 9/29/2003 12:24:57 PM
Hi All,
Does anyone know how I can calculate the exact number of
bytes that a particular field/record column is using in
the database? I know with certain data types as
byte/char/etc this is self explanatory, but I need to do
this for data types such as image, text, etc and want to
kno... more >>
SQL Joining help needed
Posted by Harag at 9/29/2003 12:16:08 PM
Hi all
SQL 2k dev ed (noob)
I got the following 2 tables (DDL below) table 1 (@main) consists of
255 rows and table 2 (@pos) contains just 12 rows.
I need to return the word from table 2 where the tbl2.MAX(minPos) <=
tbl1 pos
returned data:
(@MAIN TBL) (@Pos Tbl)
ID Pos MinPos Wordin... more >>
Update Trigger
Posted by Neal at 9/29/2003 12:14:46 PM
WHEN CHANGE is made to the CLSTATUS table, I need to GET
the CONTACTID FROM the CHANGED RECORD.
I need to RUN something like this QUERY:
SELECT ACCOUNTID
FROM CONTACT INNER JOIN CLSSTATUS ON CONTACT.CONTACTID =
CLSSTATUS.CONTACTID
WHERE CONTACT.CONTACTID = "???"
Next, IF RESULT IS ABENJ0000... more >>
reset identity field
Posted by middletree at 9/29/2003 12:06:04 PM
I have been build an ASP app, and during testing, I entered a lot of rows. I
will now get rid of the test info, and want to start fresh. The primary key
is an identity field. How can I reset it to start at a pre-defined number,
such as 1 or 1000?
... more >>
Execute within an SP
Posted by George Durzi at 9/29/2003 12:05:52 PM
Let's say I have a stored procedure called sp1, I'd like to accomplish the
following inside another sp - this is pseudo-SQL ;)
create procedure spTest
as
execute sp1 'someparamatervalue'
union
execute sp1 'anotherparametervalue'
is this doable?
obviously works without the union, I get ... more >>
Odd behavior with SUSER_SNAME
Posted by Jon at 9/29/2003 11:55:02 AM
The following sentence, when run in Query Anazlyzer on SQL 2000 DB returns
the expected result. When run in a stored procedure on the same DB, it
returns a NULL. Is there something different I need to be doing in a stored
proc? Thanks for any ideas.
declare @UserNumber int
select @UserNu... more >>
Issue w/ CASE and ">" - again
Posted by Pete Ruby at 9/29/2003 11:43:38 AM
Hello again.
I posted a message back on 9/4 about a CASE statement and "greater than".
Basically, my CASE statement works, except I have come across some values
not computing correctly, they show <NULL>. Here is my case statement:
CASE WHEN BoltHolesQty > 0 THEN '(' + convert(nvarchar, Bolt... more >>
query problem
Posted by rsync NO[at]SPAM excite.com at 9/29/2003 11:30:39 AM
Hi,
I am getting the following error when I tried to execute.
Server: Msg 241, Level 16, State 1, Line 1
Syntax error converting datetime from character string.
This is the query I'm running:
select bustimingsid, d.calc, viarouteid,
busdeparttime, busarrivaltime, busduration,
isnul... more >>
Update question
Posted by Lontae Jones at 9/29/2003 11:28:50 AM
Hello,
I have a simple update I need hep with. I have 2 tables
Server and List
Server has Server and Status
List has Server and Status
Server is the PK in both tables
I need to update the Server table with status from the
list table. Thanks!!!!!... more >>
tree structure
Posted by Adel Kamel at 9/29/2003 11:28:23 AM
Hello,
I have two Tables:
The Table City has the following structure:
City Street Street_ID
Berlin Berliner Str. 12345
Berlin Wilhelmstr. 23456
.....
Hamburg .....
.....
The Table Street has the following s... more >>
Industries popular with SQL ?
Posted by Frank Py at 9/29/2003 11:23:28 AM
Is there any statistics available on the types of industries where SQL
Server technology and personnel are in more demand?
Thanks,
Frank
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!... more >>
simple JOIN question
Posted by sfrattura at 9/29/2003 11:16:01 AM
I know how to join two or more tables, and using inner join, get the values
that appearin BOTH tables.
How do I join two tables and get the values from table A that dont appear in
table B? (Id rather not use "....where not exists..." if I dont have to)
... more >>
an sql query for me
Posted by blarfoc NO[at]SPAM yahoo.com at 9/29/2003 11:05:48 AM
hello!
create table #mytable (item int, data int)
insert into #mytable values (1, 5)
insert into #mytable values (1, 2)
insert into #mytable values (1, 8)
insert into #mytable values (1, 0)
insert into #mytable values (1, 4)
insert into #mytable values (2, 4)
insert into #mytable values (2... more >>
How to get this CASE to work?
Posted by Ivan Demkovitch at 9/29/2003 11:05:42 AM
How do I get THIS to work ?
(Without writing 3 UPDATE's ?)
UPDATE #twlShipLines
SET #twlShipLines.PackStatus = CASE TRUE
WHEN (B.Qty < QtyPickedLine AND B.Qty > 0) THEN 1
WHEN B.Qty = QtyPickedLine THEN 2
WHEN B.Qty > QtyPickedLine THEN 3
ELSE 0 END
FROM #twlShipLines I... more >>
Simple Question - I am sure
Posted by Craig at 9/29/2003 11:00:40 AM
Assume the following data:
REFNUM NAME AMOUNT
1 Joe 37
2 Tom 54
1 Bill 42
1 Sue 23
2 Sue 27
I want a sql statement to return the person who has the highest amount... more >>
Does column exist?
Posted by Len at 9/29/2003 11:00:07 AM
Hi there.
I am putting together a script that will either create a
new dB table or if the table already exists, just add a
new column to it.
If I find that the table exists, how can I check if it
already has the new column before I try and add it?
Any help would be appreciated!
Len... more >>
clear transaction log space
Posted by SQL Apprentice at 9/29/2003 10:47:11 AM
Hello,
I have a database that has a very large transaction log. My hard drive is
30GB and the log took 29GB of it. I truncated the log space but I did not
see the log space decreasing.
I can't run a backup because I am out of space.
I would like to clear out all the transaction log space ... more >>
Converting a result set to a string
Posted by DaveF at 9/29/2003 10:44:46 AM
I have a resultset that is produced from a SELECT statement that looks like
this:
12
34
55
66
I need to convert this into a comma delimited string so that it looks like
this:
'12,34,55,66'
Can this be done in T-SQL without using a cursor? If so, can anyone give me
an idea how to g... more >>
Efficiency question for an update query - help!
Posted by James Radke at 9/29/2003 10:27:11 AM
Hello,
If I have two tables, one a product table which has approximately 100,000
records, and the other a product being weighed table which at most will have
10 records based on whatever is placed on the scale, and I want to update a
field (such as sales order) for all products currently being... more >>
stored procedure returns no records called from access/ado, works in query analyzer
Posted by madhon at 9/29/2003 10:25:58 AM
as per subject if i call the following sp from an access adp file or from
ado/ado.net it returns no records, if it is run from query analyzer it
returns records ok. Any ideas why ?
CREATE PROCEDURE dbo.GetSummaryReportMonth
@eid int,
@cMonth int
AS
set nocount on
create table #MonthSum (... more >>
Tracing triggers
Posted by susan at 9/29/2003 10:08:55 AM
We have a table with some triggers on it.
Those triggers insert/update/delete into another table.
Which is also insert/update/deleted directly.
The table is now experiencing slowdowns during inserts, I
want to determine if the insert in question is via trigger
or sql directly into the tabl... more >>
Order by Max value across 5 tables
Posted by Kenrette at 9/29/2003 9:55:25 AM
I have a vendor table and 4 product tables (one for each
product category offered by the vendors). The vendors
periodically log on and update their product listings in
each of the tables through web forms. Each time they
update a product, the lastupdated value for that product
is updated.
... more >>
how to truncate transaction log space and clear the physical size
Posted by SQL Apprentice at 9/29/2003 9:52:10 AM
Hello,
I have a database that has a very large transaction log. My hard drive is
30GB and the log took 29GB of it. I truncated the log space but I did not
see the log space decreasing.
I can't run a backup because I am out of space.
I would like to clear out all the transaction log space ... more >>
Enterprise Manager Question
Posted by Greg at 9/29/2003 9:50:07 AM
Hello All,
I am sure this question has been posted before, but I am
relatively new to SQL. Can someone tell me what will
happen if I install SQL 2000 EM Client on my machine while
I already have SQL 7 EM Client installed. We have SQL
Server 7 and 2000 servers, but I heard if you modify ... more >>
Odd Behaviour
Posted by Giray Akar at 9/29/2003 9:48:18 AM
select case when ('09/26/2003 00:00:00' between '09-22-
2003 00:00:00' and '09-29-2003 23:59:59.000') then 1 else
0 end
What should I expect as result?
HINT: You do not always get what you expect!... more >>
Getting hours since sunday
Posted by David Chase at 9/29/2003 9:38:25 AM
I need to create SQL to get the sum of hours for a person since last sunday
when entering timesheets. I need to know when a person exceeds 40 hours in
a week so that the correct pay rate applies. I'm sure someone has done this
sort of thing before. I have used code to get data for a date or be... more >>
Outer joins and non-schema bound columns
Posted by henriworks NO[at]SPAM msn.com at 9/29/2003 8:48:49 AM
Initially, I was surprised to see the right-most column show in the
bottom two rows:
--------------------------------------------------------------------------------
use tempdb
create table L (L1 int)
create table R (R1 int)
insert L values (1)
insert L values (2)
insert L values (3)
... more >>
Should I use Table Variable or Temp Table in this case ?
Posted by Krist Lioe at 9/29/2003 8:21:03 AM
Hi SQL Gurus,
I break a long stored proc into some smaller stored procs.
Between stored procs I must pass result. The content of ##t
must be visible in all stored procs.
In this case, should I use ##temporary Table or Table Variable ?
Create Proc Posting AS
Create Table ##t (...)
... more >>
Query about stock tick
Posted by Agi Chen at 9/29/2003 8:21:00 AM
Hello, theres
I have a question about get the Open, High, Low, Close, Volume for a
period of time (say 1 , 5, 10, 15, 30 minute) result like follows ( 1
min)
2003-09-16 09:00:00 4401.20 4401.20 4377.93 4378.49 308074
2003-09-16 09:01:00 4379.05 4379.38 4377.12 4379.38 535052
... more >>
Full tempDB
Posted by Ginja at 9/29/2003 8:01:35 AM
Hi All,
I have a reoccurring problem with the tempdb.
Basically I have a loop of multiple DTS's that are very intensive in terms
of importing millions of rows from csv's etc.
I have developed a procedure that truncates and shrinks data/log files. I
therefore run this after each database ... more >>
Meaning of this Warning message
Posted by Suresh Kumar at 9/29/2003 7:55:57 AM
We have a long stored proc that is run every night.
We get the following message when it was run yesterday:
"Warning: Null value is eliminated by an aggregate or other SET
operation"
What statement causes this and should we be worried?
Thanks,
Suresh Kumar
... more >>
Stange error message when migrating jobs to another server
Posted by L0me at 9/29/2003 7:09:31 AM
Hi All,=20
After migrating the entire database using attach and=20
detach method from one SQL 2000 server to another one with=20
better prerequisites.
The jobs were transferred as well as everything else,=20
however they don=B4t succed anymore and generates a strange=20
error message dipla... more >>
Selecting named columns at query time
Posted by Phil at 9/29/2003 4:42:14 AM
I have a requirement to select a column from a table based
on the column name passed as a parameter.
Is this posible?
Phil.... more >>
characters in a COLLATION
Posted by ata at 9/29/2003 4:35:08 AM
hi,
how can I find the characters that exist in a collation?
please help me.
best regards,
ata giray
... more >>
Power function precision issues
Posted by Khalid Qasrawi at 9/29/2003 3:15:50 AM
It seems that the power function only captures precision
to 1 decimal place.
e.g. select power(8.0, -1.0)
yields 0.1 not 0.125 as I would expect.
Why is this the case? Is there a workaround?
For your information, I am trying to write a simple
function to round to a number of signifi... more >>
Ranking Data
Posted by DRMaltz at 9/29/2003 2:00:26 AM
Everyone,
I need to rank matching sales records. I mail customers info and try drive
them to purchase a product. Since there are multiple mailings, it's
possible that one sales can be attributed to many mailings. using a
priority ranking system, I thought I could identify which mailing to t... more >>
LOGS
Posted by phil at 9/29/2003 12:28:51 AM
My log file on my tempbd database keeps getting to large,
what would be the best syntax to use to shrink or truncate
the log.
Thanks Phil... more >>
|