all groups > sql server programming > november 2005 > threads for wednesday november 9
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
Rearrange column
Posted by Mange at 11/9/2005 11:50:03 PM
Hi!
I'll try again
I want to rearrange a column in a table within a stored procedure.
I got this table with this sample data:
ID Text Displayorder
1 Testing 100
2 Testing2 200
3 Testing3 300
4 Testing4 400
5 ... more >>
Updating Value in a string
Posted by Ghulam Farid at 11/9/2005 11:02:41 PM
Hi to All!
I have a scenario in which i want to update specific charcater in the
field
i m issuing following query but
update mytab set
substring(R,10,1) = 'A'
where substring(col049,10,1) = 'P'
this query returns me error
What will b the right query for performing the task
Thanx... more >>
Case When Syntax
Posted by Scott at 11/9/2005 8:03:11 PM
How can I use the CASE WHEN test to return a SELECT statement?
CODE:
declare @iType int
set @iType = 1
CASE @iType
WHEN 1 THEN
SELECT * FROM mytable WHERE id = 1
WHEN 2 THEN
SELECT * FROM mytable WHERE id = 2
END
... more >>
Insert only new records.
Posted by ETL at 11/9/2005 6:16:38 PM
Hello,
I have 2 tables. TableA and TableB. Both tables have the same 3 columns
in them.
Both tables have different sets of data loaded in them. I want to some
SQL each day that moves over only the records from TableB that are not
already in TableA.
So basically, I want to insert new records ... more >>
sql06 service broker
Posted by tin lam at 11/9/2005 6:12:08 PM
hi, this is the closest newsgroup i can find that relates to my problem.
please advice if there's a better one.
consider the script below:
create message type QueryMessage validation = none
go
create contract QueryContract (QueryMessage sent by initiator)
go
create queue SenderQueue
go... more >>
Auto generate String
Posted by SQL Newbie at 11/9/2005 5:39:07 PM
I have an ID Field in a table ContactInformation. This ID field is char(4)
type. And for this I want to auto generate strings starting from '0001'
onwards:
0001
0002
9998
9999
A001
A002
Z999
Thanks.... more >>
what is general/conventional way to reduce/prevent deadlock?
Posted by Rich at 11/9/2005 4:48:25 PM
Hello,
I have been reading various articles on way to prevent deadlock, like using
locking hints, nolock etc. But I am not clear on the most
general/conventional way to prevent deadlock. Like say 2
processes/procedures are trying to read/update the same record at the same
time. I under... more >>
Please test search engine
Posted by IMMO at 11/9/2005 4:46:26 PM
Hie there.
I'm a little frenchie (froggie ? lol) and I'm just working on a Web
Search engine which I would appreciate you to test...
Here the URL
http://erwann.conan.free.fr
"Insertion d'un site" means "insert a web site"
"Recherche d'un site" means "look for a web site"
Thanks a lot
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Complicated OR
Posted by Kim at 11/9/2005 4:40:12 PM
I have two tables where I'm trying to get a specific conversion factor
for a list of items. My items can have several conversion factors but
I'm only interested in LB or PCS. If the item has the conversion
factor for CS to LB I want my view to pick up that one, but if it
doesn't, it should... more >>
Temp tables
Posted by HP at 11/9/2005 4:34:59 PM
I am trying to create a temp table using a select into query.
IF @flag = 1
begin
select fieldnames into #tmp from tablename where......
end
else
begin
select fieldnames into #tmp from tablename where......
end
I am getting an error "There is already an object nam... more >>
Stored Procedure using date criteria
Posted by AkAlan at 11/9/2005 4:34:16 PM
I am trying to write a stored procedure that acts like an Append query. I
want to provide it with two dates, one is the date of records I want to copy
and the other is the date I want to be added to the new records once they get
pasted in. I am getting close with the following code:
INSERT ... more >>
SQL Profiler
Posted by A. Robinson at 11/9/2005 4:33:15 PM
I've begun to experience some quirky behavior with SQL Profiler.
In the past it has run just fine with no issues. Now suddenly, I'm beginning
to get the following error:
"Some trace events have not been reported...." because of lack of memory
resources. The trace events that seem to be get... more >>
2005 product key
Posted by moondaddy at 11/9/2005 4:31:17 PM
I just downloaded sql server 2005 dev edition from my msdn subscription,
however, in the listing of product keys, I dont see any keys for sql server.
Dont I need a product key for this when I install it?
--
moondaddy@nospam.nospam
... more >>
Log Shipping
Posted by MS User at 11/9/2005 3:51:01 PM
SQL 2005
We have ~30 db's log shipped to a different server (LOGSHIP) . If any user
connect to LOGSHIP \db1 then the hourly job keep failing for that db until
the disconnect.
That means if a connection open exits, log shipping process cannot apply the
transaction log ?? Any suggestions/i... more >>
how to install client tools for sql2005 enterprise trial download...
Posted by === Steve L === at 11/9/2005 3:41:41 PM
I installed a copy of sql2005 enterprise on win 2003 sp1 server and it
went well.
I want to manage the server thru my workstation (like EM). but there is
no documentation about how to install just client tools (such as SQL
Server Management Studio) on workstation. what are the requirements? I
h... more >>
nested cursors in stored procedure
Posted by Gary at 11/9/2005 3:34:43 PM
I have a stored procedure that attempts to process some stored data files
located in one or more directories. All the procedure tries to do is walk
through each directory and process (in this case, bulk insert) each file.
I've coded this to use 2 cursors, one to walk the list of directories, ... more >>
SQL Server Bulk Insert doesn't raise error for incorrectly formatted data
Posted by justinbauer23 NO[at]SPAM gmail.com at 11/9/2005 3:32:00 PM
It's possible that this is by design, but SQL Server Bulk Insert seems
to import incorrectly formatted data without raising an error.
Suppose I've defined the following table:
create table test_table (
field1 varchar(255),
field2 varchar(255),
field3 varchar(255)
)
The input data is in... more >>
Help with a CURSOR
Posted by Jason at 11/9/2005 3:20:02 PM
Here's my dilema. I'm trying to create a SQL script that will report back
to me every table that has a different row count from one database to
another. I believe the best way to accomplish this is using a CURSOR to
fetch through the tables in the DB and print those where the record count
... more >>
Linked server to DB2
Posted by svenpurple7 NO[at]SPAM comcast-dot-net.no-spam.invalid at 11/9/2005 3:05:35 PM
Hi all. I have tried everything I know (which isn't much) and I a
all out of ideas
I am trying to create a linked server from SQL Server 2000 to a DB
server. I am using IBM OLE DB Provider for DB2 and I get th
following error
Error 7330: OLE DB Provider 'IBMDADB2' reported an error
OLE DB e... more >>
Performance of parameterized queries
Posted by bpeikes at 11/9/2005 2:07:38 PM
I've come up with a query which allows me to perform fairly dynamic
queries depending on which parameters are set when a stored procedure
is called, but I'm not sure if what I'm doing is a performance no-no.
Here is an example:
CREATE PROCEDURE p_TradesGetForProcessing
@tradeID int = null,
... more >>
SELECT from two tables into one row
Posted by tom at 11/9/2005 1:46:13 PM
DDL posted here: http://68.6.120.147:8080/DDL2.html
I want to get data from two tables, but only that data that has changed
in the past 90 days (addrdate and phndate specify the last change
date), i.e.
SELECT addrid , addrline1, addrline2
FROM address
WHERE addrdate between dateadd(day,-... more >>
simple aggregate question
Posted by Amon Borland at 11/9/2005 1:09:52 PM
How do you perform 2 or more aggregate functions in a query? For example,
for each distinct client I need to add two values together, then determine
the overall average of all clients.
SELECT AVG(SUM(leadclient.nch1 + leadclient.npts))
FROM leadclient
This is the query but does not perform... more >>
Difficult Query, with dynamically updated data between rows....
Posted by Brian Ackermann at 11/9/2005 12:51:11 PM
Hi Everybody,
I'm looking for some help putting together a stored procedure to do a
report for my shipping department. What they are looking for is a
report listing a SalesOrder (SO), some of its pertinent information,
and then a list of the inventory we have for that part. Here's the
catch... more >>
NOT EXISTS
Posted by d4 at 11/9/2005 12:48:13 PM
I cannot seem to get this to work...
SELECT a.server,a.date FROM machines a
WHERE NOT EXISTS (SELECT * FROM file_system b WHERE
(file_name like '%XXX%') and (a.server = b.server))
Basically I need to find all the Servers in table B that have XXX
installed, and then (ultima... more >>
ERROR: "Subquery returned more than 1 value."
Posted by josh.dutcher NO[at]SPAM gmail.com at 11/9/2005 12:30:25 PM
I've got a big procedure written by a contractor. I'm trying to
execute it (against a test db until I get it worked out) and there is
one section of it that fails. I've isolated the section and run it in
Query Analyzer and it still fails. Here is the SQL:
DELETE FROM tblBedOccupancy WHERE (... more >>
How to copy SQL Diagrams
Posted by Justin Doh at 11/9/2005 11:19:20 AM
How can I copy SQL diagram from one source to other destination?
I would appreciate if you let me know.
Thanks.
... more >>
Using LIKE and IN Statement
Posted by barhoc11 NO[at]SPAM gmail.com at 11/9/2005 11:13:29 AM
I am trying to make an IN statement that has a LIKE statement in it. I
want to use the following LIKE statement in an IN statement but I am
not sure how to set it up.
(Item.Search_Description LIKE ' % ' + @OLDID + ' % ')
What I want to accomplish is for the the query to return data for the
... more >>
Error handling in sql server
Posted by Gurba at 11/9/2005 11:01:24 AM
Hi,
I have a job looping through a table containing names of databases. Based
on some criterias I want to detach some of the databases.
So far all is good.
If for some reason the detach fails, the job fails and quits.
I would like to know if I in any way can get the job to continue the loo... more >>
tempdb - experts please
Posted by trisha at 11/9/2005 10:49:55 AM
Hi,
If a query is performing an update from one table to another, then I
understand that the data is temporarily written to tempdb then committed
once the update calculation is completed.
I have a 2 questions....... imagine I am updating TableB with the
differences between TableA and Tab... more >>
dtsrun problem
Posted by John 3:16 at 11/9/2005 10:29:12 AM
Hello...
I can run:
dtsrun /SMyServer /Usa /P***** /Ntesting3
from the command line on the server and it works fine...
when I run it from a workstation on the lan, it
says "Not associated with a trusted SQL Server connection"
The security is set for both Windows and SQL authentication.
... more >>
Help with T-SQL
Posted by Ram at 11/9/2005 9:41:05 AM
TransactionId TransDT EntryExitId DirectionId TagHexId
TrTypeId
54 2005-11-08 10:00:00.000 1 1 0FE48B54
1
55 2005-11-08 10:05:00.000 2 1 0FE48B54
1
56 2005-11-08 10:06:00.000 1 ... more >>
Join inline function in select
Posted by Shailesh Patel at 11/9/2005 9:33:37 AM
Hi,
I call inline function in stored procedure like:
SELECT tab1.Col1, tab1.Col2, fnTest.*
FROM tab1, fnTest(Col1, y)
WHERE tab1.Col1 = Col1
fnTest(Col1, y) returns one row and by joining I want to get row based on
multiple Col1 passed as parameter in function call in FROM clause.
Than... more >>
Getting a custom sized page from a sorted result set
Posted by Lars-Erik Aabech at 11/9/2005 9:14:27 AM
Hi!
I've tried numerous solutions to this classic problem. I know how to do a
pretty scalable solution, but I'd like to hear some more ideas.
What I do now is something like this:
1. Declare a cursor inside an exec statement since order by doesn't support
variables
(I know about the ... more >>
Mass Alter Column Across Tables?
Posted by xenophon at 11/9/2005 8:43:16 AM
I have a Database with 22 tables, all with a column "MyColumn"
Char(40). There are 30 tables that do not have the column.
I need to alter all of the tables with "MyColumn" to make the column
44 characters wide.
I am struggling how to do it in a set-based operation without
hardcodi... more >>
Database Diagrams on SQL 2000
Posted by Lazer at 11/9/2005 8:41:24 AM
So there is no way to create a Database diagram on a SQL 2000 database using
SQL Server management studio 2005 even though that database diagrams is not a
new feature?
Thanks... more >>
Global setting for business (5 day) versus calendar week
Posted by Ledd at 11/9/2005 8:31:02 AM
Is there a global setting to specify a business (5 day) versus a calendar (7
day) week for date calculations?... more >>
SourceSafe Integration in 2005
Posted by yonision NO[at]SPAM hotmail.com at 11/9/2005 8:25:58 AM
Hi,
i want to know, just in general, what does 'SourceSafe integration'
means in 2005. does that mean that i can use the new query analyzer (or
whatever its called) to check in\checkout stuff directly from
SourceSafe? anything more, anything less?
thanks
... more >>
SQL 2005 space requirement for install
Posted by moondaddy at 11/9/2005 8:20:28 AM
How much space do i need to have on a machine to install SQL Server 2005 Dev
edition?
--
moondaddy@nospam.nospam
... more >>
Help with a query please....
Posted by Chris Ashley at 11/9/2005 8:14:40 AM
I have two tables, data_branchAddOns:
CREATE TABLE [dbo].[data_branchAddOns] (
[id] [int] IDENTITY (1, 1) NOT NULL ,
[branchId] [int] NOT NULL ,
[name] [varchar] (30) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[displayText] [varchar] (100) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NU... more >>
How to rewrite this query using LEFT OUTER JOIN?
Posted by mEmENT0m0RI at 11/9/2005 8:10:46 AM
Hello Everyone!
I'm having problems with the INNER JOIN in the subquery. If it wasn't
for that, I'd be able to LEFT JOIN it and then check for nulls on the
right side, but I'm not sure where I'd stick the INNER JOIN.
SELECT COUNT(*)
FROM FND_DONATION_MASTER F
WHERE F.SHIP_CUSTOMER NOT IN
... more >>
Delete statement again
Posted by harish at 11/9/2005 8:09:30 AM
set rowcount 100000
declare @a int
while 1=1
begin
begin tran del1
delete from dbo.extt_vpm_ldr_stg_2
select @a = @@rowcount
print @a
commit tran del1
if @a < 100000 break;
end
Hi
TOTAL TABLE SIZE - 650 000 records
I am using the above statement to delete in ... more >>
Looking for good Migration tool which can convert Access db to SQL
Posted by Rao at 11/9/2005 7:51:13 AM
I'm looking for migration tool which can convert Access database to SQL
Server. Any one which works 100%. Any suggestions would be greatly
appreciated.
Regards,
Rao
... more >>
Triggers take time, but processor not 100%, upgrade hardware or no
Posted by Steve'o at 11/9/2005 7:04:47 AM
Im making a presumption / hoping that a few sql server programmers have, by
definition of what they do, a good understanding of the hardware
relationships to performance. Im concerned that a costly upgrade will yield
little result, apart from a very red face from me :)
Current setup:
SQL ... more >>
T-SQL Help Needed
Posted by Eeraj at 11/9/2005 7:02:05 AM
Given the following data in table 'table1':
RowID EmployeeID Amount
1 A 1000
2 B 200
3 A 350
4 C 1500
5 B 50
6 A 300
I want to extract the Maximum amount for each employee. So, for the data
above, the resultset would look like this:
RowID EmployeeID Amount
1 A 1000
2 B 200... more >>
trigger problem
Posted by uros at 11/9/2005 6:49:13 AM
I want to perform some dynamic Sql statements on inserted and deleted tables.
But the sql gives me an error, that these tables does not exists.
Where are inserted and deleted tables "hidden", so that I could reference on
them, for example:
exec('select '+@lcField+' from deleted' )
Uros... more >>
XML DML
Posted by Sebastian Rose at 11/9/2005 5:55:02 AM
How does the update, delete or insert in a xml column work?... more >>
Query with multiple tables
Posted by Sebastian Rose at 11/9/2005 5:54:01 AM
How can i xquery the results from multiple tables?... more >>
Rearrange column
Posted by Mange at 11/9/2005 5:33:06 AM
Hi!
I want to rearrange a column in a table within a stored procedure.
I got this table with this sample data:
ID Text Number
1 Testing 1
2 Testing2 2
3 Testing3 3
4 Testing4 4
5 Testing5 5
I wa... more >>
I don't remember...
Posted by Enric at 11/9/2005 3:41:02 AM
Dear folks,
Could you please so kind to tell me where the fixed type data stored are? I
mean, in what system table are available these data?
"bigint, binary, float, decimal", and so on
Thanks in advance and regards,
Enric... more >>
multiple view create
Posted by romy at 11/9/2005 1:57:33 AM
Hi
How can I create multiple views in a single SQL script ?
(I get an error: 'CREATE VIEW' must be the first statement in a query
batch.)
thanks
... more >>
Is this guaranteed: SELECT TOP 1 FROM ... ORDER BY Field1, Field2, Field3
Posted by Jay at 11/9/2005 1:41:37 AM
SELECT TOP 1 FROM ... ORDER BY Field1, Field2, Field3
Will the statement below, always return the first record of the same
stand-alone SELECT statement as below:
SELECT * FROM ... ORDER BY Field1, Field2, Field3
Thanks,
Jay
... more >>
SQL Server 2005 question
Posted by Kevin S. Goff at 11/9/2005 1:38:07 AM
Anybody using Sql Server 2005? I'm curious as to what happened to the
Service Manager in the system tray, like SQL 2000 had? I know that
Configuration Manager that does the same stuff
(starting/pausing/stopping the Server), but it sure was convenient
having that in the system tray before. Anyone... more >>
Time Deadline Trigger
Posted by Aditya at 11/9/2005 1:35:12 AM
I want to write a trigger , which will delete a particular row when the
system time(server time) matches with the time previously given by a user (in
the front end).This deleted row should then automatically get inserted into
another table.
ITS REALLY URGENT, AND I WANT AN IMMEDIATE REPLY P... more >>
Location of a condition in a join
Posted by Lisa Pearlson at 11/9/2005 12:03:42 AM
Hi,
I often do something like this:
SELECT ...
FROM Table1
LEFT OUTER JOIN Table2 ON (Table2.Id = Table1.Id AND Table2.Deleted<>0)
LEFT OUTER JOIN Table3 ON (Table3.Id = Table2.Id AND
Table3.Deleted<>0)
WHERE
Table1.Deleted<>1
I've been suggested on here to break ou... more >>
SQL Server 2005
Posted by Leila at 11/9/2005 12:00:00 AM
Hi,
How can I use newsgroups of SQL Server 2005?
Thanks in advance,
Leila
... more >>
Weekly Repeat Problem
Posted by Jon at 11/9/2005 12:00:00 AM
Mmmm .. SQL and dates ... always fun ...
I have a MS SQL database that holds bookings for various resources. Bookings
are held in two tables set up as follows:
ID | Schedule ID | Start time | End Time | BookedByName
ScheduleID | ResourceID | ScheduleDate
Both time and date fields are '... more >>
|