all groups > sql server programming > july 2003 > threads for friday july 25
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
admin type scripts...
Posted by anthonyn at 7/25/2003 10:31:48 PM
Anyone know where I can find example scripts that will compact, recover,
re-index etc... I am using vb.net, I would need to initialize it from there
or from my app that is...
Thanks,
Anthony Nystrom
... more >>
SQL queries
Posted by Warren at 7/25/2003 7:07:48 PM
I have a problem with fox pro tables that are connect to access databases.
Two different locations of the same program has data files that are named
the same. I am trying to link to the two different files with access 2000
with a link to the tables. When I try to build a table using the two li... more >>
DELETE Query
Posted by Wayne Wengert at 7/25/2003 6:23:05 PM
I have a table of Customers and another table that contains orders from the
last year. I want to delete all those customers who have NOT placed any
order in the last year (i.e. that cust number is not in the orders table). A
given Customer number may be in the orders table more than once.
Is t... more >>
SQL Challenge: Collapsing overlapping date ranges
Posted by Brian Baker [MVP] at 7/25/2003 5:12:11 PM
Hello all,
I have a little challenge that I've been struggling with. The scenario is
below. Note that the source table has over 2 million rows. The first
solution we tried copied the table to a temporary table and then used a
cursor to iterate over the rows and delete or modify from the tem... more >>
stored proc datatype error
Posted by John Pether at 7/25/2003 5:04:59 PM
I have the following stored proc which is giving me an Error converting data
type nvarchar to numeric error. Can somebody please help me trace the
problem.
-----------------
Stored Proc
-----------------
CREATE PROCEDURE spAuthoriseLink
(
@LinkID Numeric,
@URL nvarchar(255),
@Link... more >>
CAST float to Decimal with the scale as a variable
Posted by Next at 7/25/2003 5:01:28 PM
I have a need to cast a float to a decimal using different scale values:
In my Select, I have
CAST( th.price AS DECIMAL( 30,CAST(p.qty_decimal as int) ) ) as price
I have tried many things but I alway get "Incorrect syntax near 'CAST' ".
qty_decimal contains values from 0 to 8
Is it... more >>
Hi
Posted by Shafeek at 7/25/2003 4:30:29 PM
I've a member table, It stores address fields also. I need to select the
oldest person from each house.
I pulled the data bases on group by and not able to get the primary key, how
an I get that key when using group by. I tried alias also, but output is not
correct.
... more >>
Appending values to a variable in SET statement
Posted by mitra fatholahit at 7/25/2003 4:05:59 PM
Hello Everyone,
I am fetching through a table, tb_1, to get all the group
names to which a user belong.
I need to save all the group names i get back into ONE
VARIABLE and separate the group names with either a space
or a comma.
Using SQL Sever QA 2000,I am running the code shown be... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Sql Insert statement question
Posted by Jonathan at 7/25/2003 3:26:03 PM
Sorry if this is a basic question but I have spent the
day looking and can not determine how to do this.
I want to run a query from Sql server as a job. That
updates a table based on fields in a second table. That
part I have done without problem.
My problem is that I also want to insert ... more >>
A severe error occurred on the current command
Posted by mikeheard NO[at]SPAM nospam.com at 7/25/2003 2:08:42 PM
I have an ASP.NET app that has been working for a while
now but just started reporting errors when attempting to
execute a stored procedure on SQL Server. There have been
no major changes since the app worked - 2 columns were
added to the table I'm attempting to modify with the
stored pro... more >>
text to sql tables
Posted by trint at 7/25/2003 2:03:08 PM
is it possible to use dts to load a different .txt file
into different tables of the same database?
thanks in advance,
trint... more >>
multiple language
Posted by ming at 7/25/2003 2:00:33 PM
Hi, I have question about multiple language handling.
I want to store US-English and Japanese in my database and
create value column and lang column to store the value and
lang value.
Since Sql Server instance only allows one collation, which
collation I should use, SQL_Latin1_General_CP1... more >>
maximum varchar stored procedure parameter size?
Posted by Steven Yarger at 7/25/2003 2:00:11 PM
All-
Does anybody know the maximum size for INPUT or OUTPUT varchar stored
procedure parameters, or where I can find it?
I looked all over the Help and couldn't find an answer.
thanks!
... more >>
Searching condition uin SQL
Posted by Daivd Mainer at 7/25/2003 1:58:21 PM
Hey all,
I came across a SQL: select * from customer where Name <>
N'Tom'. What does "N" mean in this case?
Thanks
David... more >>
Can I do a "Bulk Insert" without using BULK INSERT?
Posted by Stuart Cross at 7/25/2003 1:58:01 PM
I have a problem in that I need to shuffle a lot of data from the client to
a table in my database.
Previously, I was copying the data in a text file, then using BULK INSERT to
accomplish this.
However, I can no longer use this method on our new server, as the DBA
doesn't want to add all th... more >>
Update problem
Posted by Gena at 7/25/2003 1:29:05 PM
Hi,
I need help to update dates in a table below.
Here is a fragment of the table:
emp_benefit_id benefit_id coverage_end_date
-------------- ----------- ---------------------------
168 101 2003-12-31 00:00:00.000
175 101 2003-12-31 00:00:00.000
202 ... more >>
mdx/analysis manager
Posted by newbie at 7/25/2003 12:59:06 PM
I'm a new user of SQL Server and Analysis Manager. I'm
wondering where it is that you can write MDX or SQL.
Maybe I could get some help in arranging data, because I
feel like I'm hacking my way through. It's probably
because I a newbie at this.
I have this table in an Access Database. I... more >>
LAST FUNCTION
Posted by borr at 7/25/2003 12:31:21 PM
Hi,
For those of you that are familiar with MS Access... when
you have a query and you use a group by, Access has a
function called "Last". What this does is give you the
last record of a group of data.
For example....
ID Date_Column
1 ... more >>
Backup and Restore of DTS
Posted by Patrick at 7/25/2003 12:02:50 PM
Hi Freinds,
How can I backup and restore DTS Packages on my server?
Thanks,
Pat
... more >>
Multi-threading DB Updates
Posted by Howard Zager at 7/25/2003 11:21:48 AM
I have a large table (1 million rows) which I horizontally
partition into 4 sets of contiguous rows (250K rows each)
by PartitionID. I want to do a complex calculation with a
function call to update one column in this table.
I've created a stored proc to do this update. It accepts
a P... more >>
How to capture both @@error and @@rowcount?
Posted by Dmand at 7/25/2003 11:17:19 AM
Following an update query I wish to be able to reference both the @@error
variable and the @@rowcount variable,
e.g.
update test set test.col1 = 'x'
if @@error <> 0
print 'error ' + convert(varchar,@@error)
else
print convert(varchar,@@rowcount) + ' rows were... more >>
IF EXISTS (SELECT TOP 1 * FROM mytable)
Posted by Next at 7/25/2003 11:01:05 AM
I am curious...EXISTS function returns true if there is a least one record
in the selection.
Does the SELECT statment gather all records before the EXISTS function
evaluates whether there are records in the result set?
In other words...
Is this statement any more effiecient
IF EXISTS ... more >>
Help with Query
Posted by DaveF at 7/25/2003 10:56:32 AM
I have an orders table with an orderid, custid, and orderstats field. The
orderstatus field can be 'c'. 'i', 'x', 't' or 'e'.
Customers can have many orders with different status.
How can I get all of the customers who have only orders with 'e' status?
The following gives me all customers... more >>
sp_spaceused: rows=0, but is incorrect.
Posted by Laurie Mountjoy at 7/25/2003 10:52:15 AM
Does anybody know a way to fix this?
I've tried all the statistics-related techniques. DBCC SHOW_STATISTICS
shows the correct number of rows, but sp_spaceused shows 0.
Any ideas (other than editing the system tables)?
Laurie
... more >>
T-SQL Reference
Posted by Tom Lee at 7/25/2003 10:40:08 AM
What is a good general purpose reference book on T-SQL syntax and usage?
Tom L.
... more >>
sp_statistics, sp_spaceused return incorrect results
Posted by Laurie Mountjoy at 7/25/2003 9:51:36 AM
I have a table - SELECT COUNT(*) returns the correct number of rows, but
sp_statistics gives Cardinality=0, sp_spaceused gives Rows=0.
How can I fix this?
Laurie
... more >>
Milliseconds bug?
Posted by Panos Stavroulis at 7/25/2003 9:44:25 AM
Hi,
Run the following statement
declare @d datetime
select @d = '2003-07-25 17:19:46.542'
select @d
It produces!!
2003-07-25 17:19:46.543
Does anybody know why there is a one millisecond
difference when I select it to be 542 and it comes as 543?
Thanks,
Panos, London.... more >>
Updating ID field
Posted by Ravi at 7/25/2003 9:41:39 AM
Does anyone know how to update an id field(pk) with
relationships without removing the relationship?
In other words force an update to field with relationship.
Any assistance would be greatly appreciated.
Thanks,
Ravi... more >>
SQL server logs
Posted by Abhijeet Raje at 7/25/2003 9:05:08 AM
Hi All,
I want to find out the time and which user(e.g. sa) has modified the
database (Table, view, SPROC, etc) schema in SQL server 2000.
as well as any insert/update/delete on tables.
In short like IIS LOGS is there any way to find out Who and When and What
did to SQL server.
Can any... more >>
Help with update query
Posted by Ricky at 7/25/2003 8:59:05 AM
Q1. The table structure is
ID, Plant, Inc, TagIdentifier, Desc. Id is the primary Key.
I want to update the Tagidentifier column with new values
based of inc field value in this same table.
I wrote:
update Tablename
set tagidentifier = (select newtagname = case
When inc = 0 the... more >>
SELECT DISTINCT problem
Posted by Helixpoint at 7/25/2003 8:49:23 AM
The following SQL works, but the SQLbelow that does not. Is there a way to
do the second SQL???
SELECT DISTINCT InventoryRecord.codesID, MachineCodes.CATNUM,
MachineCodes.DESCRIPTION
FROM InventoryRecord INNER JOIN
MachineCodes ON InventoryRecord.codesID =
Mac... more >>
Datetime without time
Posted by Miroo_news at 7/25/2003 8:20:59 AM
Hello,
Is there a better way to remove time part from datetime then
CONVERT( DATETIME, FLOOR( CONVERT( FLOAT, MY_DATE)))
?
Better means faster, shorter, etc...
Regards
Miroo... more >>
Need help with an Update statement
Posted by angela NO[at]SPAM kaisen.co.uk at 7/25/2003 8:20:38 AM
HI,
I think I might be having a brain fade can anyone help?
I need to update the classification_id column in table1 with new id's from table 2.
table 1
classification_id
2
3
4
5
table 2
classification_id | new_id
2 1
3 4
4 ... more >>
Creating a table in a stored proc then inserting n updating...HELP!!
Posted by GK at 7/25/2003 7:14:10 AM
hi,
i'm a new sql server user so plz pardon my ignorance if
wat i'm about to ask makes u laugh or frown at the
simplicity..
ok here goes,
i'm using mssql8. I've created a 2 temp tables in a stored
proc - the first table returns Debit order Rejects and the
second retuns Debit orders Receiv... more >>
Stored Procedure with fields as parameter for a select statement?
Posted by Rog at 7/25/2003 6:33:45 AM
I would like to have a stored procedure where I pass in
parameters of fields or even tablenames and fields as
parameters for the select statement....
Select Param1, Param2,Param3 from Param4?
Is this possible?
I tried this just as above, but it didn't work. Curious
if anyone knows ho... more >>
sql server error msg 306
Posted by yanping at 7/25/2003 6:05:07 AM
hi, again,
can anyone help me with the below error msg when users
update records from the access application:
Server: Msg 306, Level 16, State 1, Line 1
The text, ntext, and image data types cannot be compared
or sorted, except when using IS NULL or LIKE operator.
the main column that fa... more >>
Disabling Round on convert
Posted by Julio Carvalho at 7/25/2003 5:56:17 AM
Hi,
I have a variable decimal(9,4) and i want to convert it to
decimal(9,2) but i don't want to round the number, i want
to truncate it, like this:
declare @a numeric(9,4)
set @a = 100.1399
print convert(decimal(9,2), @a)
This results in "100.14" but i need to get "100.13"
I know i c... more >>
Read Only DB
Posted by Elisabeth Smith at 7/25/2003 5:04:14 AM
HI,
Is it possible to programatically set a DB to Read Only?
I have a job which archives data daily at 3:00am and
stores it in an Archive DB. I'd like this DB to be Read
Only so that no historical data can be accidentally
deleted but of course I'd like it to be reverted to non
Read On... more >>
Triggers Question
Posted by Rick at 7/25/2003 4:52:07 AM
Is it possible to create a trigger that fires when a new
field is added to a table in the database?
Any Ideas would be great.
Thanks... more >>
create a proc in a proc
Posted by Howard Houlston at 7/25/2003 4:01:16 AM
I want to create a new database in a stored proc which
includes table + other procs. Creating the database +
tables is no problem, but does anyone know how I can
create the procs?
Say I'm running the creation proc from master and the
target is database TEST1
My sample code so far:
DE... more >>
Problem connecting remote server
Posted by Niitmalad at 7/25/2003 3:41:01 AM
Dear Friends
With the advice form the friends of Newsgroup. i am tring
to setup thh link server from my remote office.
I have compteted the following steps.
On Remote Server:
1. New fixed IP for the server running SQL server.
2. Open port 1433 on Firewall
On My server where i am m... more >>
Triggers Question
Posted by Rick at 7/25/2003 3:38:47 AM
Hi,
I have a question for you, I'm new to SQL programming so
I'm not sure if this is possible.
I want to setup a trigger that will fire if a new field is
added to a table in the database. Any advice would be
greatly received.
Thanks
... more >>
Sql server 2000 book recommendations, Anyone?
Posted by DDK at 7/25/2003 1:09:46 AM
I am looking to buy a Sql Server 2000 book, and was wondering if anyone had
a favorite Sql Server 2000 book they would recommend. I'm looking for a
book that details things such as backing up, security/ log in, T-SQL, and
stored procedures, etc.
Thanks for your insight,
D.
... more >>
uniqueidentifier missing curly brackets
Posted by colinknep NO[at]SPAM yahoo.com at 7/25/2003 12:38:20 AM
After moving an ASP3 site from one hosting provider to another,
whenever I execute a sproc that selects a uniqueidentifier (in XML
format) ..... the curly brackets around the uniqueidentifier are
missing. This didn't happen on the previous site (same code).
For example:
<%=objLoopNode.geta... more >>
|