all groups > sql server programming > may 2005 > threads for tuesday may 24
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
Nested query
Posted by Ant at 5/24/2005 10:46:01 PM
Hi, I'm just starting out with SQL. I'm wondering why this nested query
doesn't work. I'm sure it's something simple but I'm not sure what. Hope
somebody can shed some light.
Thanks in advance
Ant
SELECT myDate,
SUM(deposit)
FROM
(
SELECT CAST(DATENAME(MONTH,date)+ '' + DATENAME(Y... more >>
trigger firing
Posted by nonno at 5/24/2005 10:24:01 PM
will a insert/update/delete trigger be fired if there's no any row affected
by the insert/update/delete statement?... more >>
multiple table joins, does the "ON" clause determine which two tab
Posted by Geoff at 5/24/2005 9:10:04 PM
How do you know which table is the intermediate or translation table in a
query using multiple joins.
For example:
SELECT T1.ID
FROM T1 LEFT OUTER JOIN T2 on T1.ID = T2.ID LEFT OUTER JOIN T3 ON T1.ID =
T3.ID
WHERE (T2.ID IS NULL) AND (T3.ID IS NULL)
T1
---
A
B
C
D
E
T2
-... more >>
Help with query
Posted by Rene at 5/24/2005 8:46:43 PM
Suppose that I have a table that represents the chain-of-command hierarchy
of a company. Lets say that the first column of the table represents the
employee name and the other represents the employee's boss. Lets also assume
that one employee can have several bosses.
What I would like to do... more >>
deal with larger amount of data.
Posted by gladiator at 5/24/2005 7:29:09 PM
Hello MVPs:
we have several tables with many records(about
10000000,developement Database is MS SQLSERVER 2000 Enterprise.). the data is
quite static,and it is not change frequently.We have many batchs running at a
fixed schedule.mainly we query
against these tables.
is t... more >>
table with many recodrs
Posted by gladiator at 5/24/2005 6:37:03 PM
Hello MVPs:
we have several tables with many records(about 10000000,Database is
MS SQLSERVER 2005.). the data is quite static,and it is not change
frequently.We have many batchs running at a fixed schedule.mainly we query
against these tables.
is there any solutions to impr... more >>
Deleting certain text patterns from a column
Posted by Kevin at 5/24/2005 6:28:06 PM
Hi,
I have a column in SQL DB and the column contains the information like:
<ProductDescription>This TV is good. </ProductDescription> This TV is sold
out.
<ProductDescription>This TV is bad. </ProductDescription> This TV is not
selling well.
(By the way, I am NOT talking about the XML... more >>
sql server transaction question
Posted by dmalhotr2001 NO[at]SPAM yahoo.com at 5/24/2005 6:22:46 PM
Hi,
I have an issue with my query.
1. I have 1 stored proc which have execution calls to multiple stored
procs within it.
2. I want to wrap that main stored proc in the transaction and rollback
if there are errors execution calls to other stored procs. I don't
believe my code is account... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
How to resolve deadlock in this case
Posted by Hassan at 5/24/2005 5:13:52 PM
I have a stored procedure that runs along the following lines
Begin tran
update a
......
insert a
......
Commit tran
and when these stored procs run concurrently, we see deadlocks at times .
How can I rewrite this query to avoid deadlocks ?
... more >>
stored proc paging performance
Posted by Bill at 5/24/2005 4:34:29 PM
I am using the stored procedure method of paging where you select your
results ordered into a temporary table then select the page you want based
on a unique id. I am try to maximize performance so I wanted to know....
1. Is this the best way to perform paging performance wise?
2. If so... ... more >>
upload excel files to sql server
Posted by christy at 5/24/2005 4:34:02 PM
I need to upload multiple excel files from a directory to sql server very
night. I will not know the flile names but the layout are the same. The
process needs to do an insert if the key is not there, otherwise, do an
update.... Any examples? DTS or VBScript? Can DTS be setup so it will proces... more >>
How to use DCount function
Posted by sharman at 5/24/2005 4:30:01 PM
I am new to SQL Server. I want to use the DCount function ( Iam trying to
enter the occurence of a particular field in another field) in a Update
query but it gives me an error message. Is there a way out? Thanks in advance.... more >>
TopN
Posted by Paul Ilacqua at 5/24/2005 4:06:37 PM
Instead of writing 8 or 10 different selects for each individual
Dept, as in the sample 2 below. I would like to end up with one SQL
statement the "passes the departments in" based on a departments list and
get the top 5 per dept in a single recordset.
I know it's possible, but my ... more >>
questions about proper sql licensing...
Posted by === Steve L === at 5/24/2005 3:29:25 PM
I have a few questions about sql licensing...i've read the licensing
info on MS site and it's kind of fuzzy.
1. per cal vs per processor.
if I purchase one cal for an user, does that mean that cal can access
any number of sql server?
2. in a per cal scenario, if a phone system software is c... more >>
how to delete distribution database
Posted by Patrick at 5/24/2005 3:05:03 PM
Hi Friends,
SQL 2000
I resotred a backup of distribution db as d21 and now when I am tryiong to
delete this db , it does not let me to do so, saying , database in
replication.
How can I delete the d21 database ?
The repplication is on and going now.
Thanks,
Patrick
... more >>
Complex File Import
Posted by Chris Lieb at 5/24/2005 2:53:07 PM
I am trying to import a flat file of semi-colon delimited values into a
table. The table has many foreign keys that reference other tables. The
flat file has the data all explicitly stated instead of the ID numbers. I
want to make it so that if a new value is encountered, a new entry in tha... more >>
Looping Question!!!!!..........
Posted by tom d at 5/24/2005 2:50:03 PM
Hi all,
I have an initial parameter = 'TST0001'
I want to write an INSERT statement to automatically take the initial
parameter 'TST0001' and keep adding 1 to it until it get to 'TST9999'.
Now, my table should store data like these:
TST0001
TST0002
.....
....
TST0010
TST0011
....
..... more >>
Display Image Datatype field from a table in Reporting service report...!!!
Posted by Query Builder at 5/24/2005 2:48:43 PM
I have a table that has an image datatype column and I also have a
contant type column in that same table to define which type of data is
stored in that table.
In this case a screen shot or may be a word document may be stored in
that table....!
I am trying to use that image datatype field ... more >>
Updating a field in one table with values from a field of another
Posted by Jack at 5/24/2005 2:40:06 PM
Hi,
I have two tables i.e. AgencyStats1_2005 and AgencyStats1_2005_missing
The two tables have a common field i.e ORINumber. The table
AgencyStats1_2005_missing has all the offense values which need to be used to
update the offense field of table AgencyStats1_2005.
I am writing the followin... more >>
What datatype is best to store longitute & latitude?
Posted by bmurtha at 5/24/2005 2:37:28 PM
Does anyone have experience with this, offer any suggestions.
Thanks in advance,
Bryan... more >>
query question
Posted by Stephanie at 5/24/2005 2:36:19 PM
Consider
Table1
ID
Name
and Table2
EntryCode
EntryDesc
I want a query to retrieve all combos.
So if Table1 has
ID Name
1 Jane
2 Fank
and Table2 has
EntryCode EntryDesc
One First
Two Second
Three Third
I want
ID EntryCode
1 ... more >>
Multi table designations in sql string
Posted by .Net Sports at 5/24/2005 2:34:40 PM
I'm putting together a resultset in an sql string
(it will be used in asp.net) where I'm drawing from a few different
tables, and I do have a relation with the tblDeal and tblSalesrep ID :
'''''''
strSQLQuery = "SELECT d.salesrep_id,s.fname,s.lname,
s.boardtotal_note,s.BoardTotal_BonusPerc, s... more >>
Hypothetically speaking...
Posted by Mike Labosh at 5/24/2005 2:34:33 PM
Let's pretend I'm running a big fat batch in a giant stored procedure that's
chewing on about half a million rows, and meanwhile, some clown in MIS
decides it would be a neat idea to reboot the big momma SQL Server in the
middle of the work day.
What might happen? Think the MSSQLServer ser... more >>
Stored Procedure Parameter Questions
Posted by Jeronimo Bertran at 5/24/2005 1:49:59 PM
I have a couple of simple questions about parameters in Stored
Procedures:
1- Can I use an integer parameter to define the maximum number of rows
to return using the TOP Clause? SELECT TOP @MaxRows ?
2- How do I declare and use a boolean parameter?
3- Is there a way to construct a WHER... more >>
Killing all sleeping processes
Posted by microsoft.public.dotnet.languages.vb at 5/24/2005 12:57:51 PM
Hi All,
When I run sp_who2, I see there are many sleeping processes. Instead of
killing one by one, I was wondering if there is any way to kill all
sleeping processes programmatically (MS SQL Server 2000).
Thanks a million in advance.
Best regards,
mamun
... more >>
how to find out the who last modfied the stored procedure
Posted by Bhaskar at 5/24/2005 12:18:02 PM
Hi ,
I want to know how to find out the who last modified any stored procedure
in the database.
is there any way?
thanks in advance
Bhaskar
... more >>
Problems with duplicate data
Posted by tshad at 5/24/2005 11:45:06 AM
I have the following table:
CREATE TABLE [dbo].[Applicant] (
[ClientID] [varchar] (20) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL ,
[ApplicantID] [bigint] NOT NULL ,
[PositionID] [int] NOT NULL ,
[JobID] [bigint] IDENTITY (1, 1) NOT NULL ,
[DatePosted] [datetime] NULL ,
[FirstName] [... more >>
Using xp_fixeddrives on a linked server
Posted by Wex at 5/24/2005 11:37:06 AM
I am trying to monitor drivespace on several servers. I am creating code on
a monitoring server that will go out and test drive space and page me if
limits are reached. I have set up linked servers, and tested:
Exec LinkedServerName.master..xp_fixeddrives -- It works great.
The problem... more >>
simple sorting error
Posted by Paul at 5/24/2005 11:13:30 AM
SELECT TOP 100 * FROM ProductsChangeLog ORDER BY created DESC
---
Server: Msg 536, Level 16, State 3, Line 1
Invalid length parameter passed to the substring function.
The 'created' column is datetime with NO NULLS. Maybe there is a bad entry
that SQL server is tripping on, but I have no idea... more >>
Indexing columns question?
Posted by Rich at 5/24/2005 10:13:04 AM
I have 2 tables that both contain around 500,000 records a piece. There are
about 180 column in each table and each row averages about 20k to 50k of
data. After adding some indexes to the tables my sp's are running much
faster now. In the selections for the Indexes I have unique, clustered,... more >>
Carriage Returns in Data
Posted by JLFleming at 5/24/2005 8:50:07 AM
I have a ntext field of data. I was trying to use the REPLACE function to
change the carriage returns to spaces, but have not any luck.
Can anyone make any suggestions?
Thank you,
JLFleming... more >>
Counting Question
Posted by tarheels4025 at 5/24/2005 8:48:04 AM
Below is what I currently have in query. I have a question for the line that
has an asterisk before it.
Is there a way to show if a card number has shown up more than once on a
given settlement _batch_num? I have no clue what to put as the COUNT CASE
since I am searching over a period of ... more >>
Time Stamp to prevent lost update
Posted by Dan Holmes at 5/24/2005 7:40:54 AM
I can't remember the name of the process but i am thinking of putting in
a time stamp column so i can prevent a lost update. In prose when the
row is read an modified check to see if the time stamp is the same on
update as it was when it was read. Here is what i am unsure of. Does
the upd... more >>
Loading a EDI file into SQL Server
Posted by karenmiddleol NO[at]SPAM yahoo.com at 5/24/2005 2:08:35 AM
I have a urgent need to for processing some EDI files to be loaded into
SQL Server and also outputting data in SQL Server to EDI.
Can somebody kindly share a sample EDI file and an scripts you have
built to process this file inbound into SQL Server I would greatly
appreciate the help.
Also,... more >>
Database Mirroring
Posted by Renjith at 5/24/2005 1:44:04 AM
Hi
In SQL Server 2005 there is a function for Database Mirroring which will
syncronize between 2 sql server databases .
the more details are explained in the following link.
http://www.databasejournal.com/features/mssql/article.php/3440511
the same option can be done thru SQL Server 2k... more >>
T-SQL syntax question
Posted by sijj NO[at]SPAM yahoo.com at 5/24/2005 12:48:52 AM
I've found a syntax error reproduced in this small example
USE Northwind
select * from Orders o
inner join (
select od.OrderID from Products p
inner join [order details] od
on od.OrderID = o.OrderID -- this doesn't work
-- on od.OrderID = 10251 -- this works
) rb
on o.OrderID = ... more >>
Speed of multiple sum() in CASE statement
Posted by Hugo at 5/24/2005 12:09:02 AM
I just need to know how effective this query is?
CASE WHEN sum([DEBIT AMOUNT]) > sum([CREDIT AMOUNT]) THEN sum([DEBIT
AMOUNT]) - sum([CREDIT AMOUNT]) ELSE 0 END
[OPEN DEBIT AMOUNT]
Should I rather to the sum() functions in a subtable?
e.g.
SELECT
CASE WHEN [DEBIT AMOUNT] > [CREDIT AMO... more >>
change nchar to char
Posted by Win at 5/24/2005 12:00:00 AM
Can I change a double byte (nchar) to 2 single byte (char)?
... more >>
Triggers.Inserting the new inserted value into another table
Posted by Star at 5/24/2005 12:00:00 AM
Hi,
I have a trigger where I would like to insert the new inserted value
into another table. How can I do that?
I tried with this:
insert into CallsSync
select * from Inserted
but I get an error because I have text fields inside the source table.
Thanks... more >>
Help with update forms
Posted by Richard at 5/24/2005 12:00:00 AM
Hey Guys
Still very new to asp/sql but trying to learn stuff as I go along.
I'm trying to create an update form where it pulls in an existing record, I
can update it, then submit the changes.
The problem i'm having is when i click to update the record I get this error
message
Cannot ... more >>
sp_executesql
Posted by simon at 5/24/2005 12:00:00 AM
Because sp_executeSql supports parameters not longer then 4000 characters, I
split sql statement in 2 parts:
(my sql statement is 6000 characters long)
declare @sql nVarchar(4000)
declare @sql1 nVarchar(4000)
SELECT @paramlist = '@xDMLz int,@xDMLk int,@xdatumZ datetime,@xdatumK
datetim... more >>
conditional syntax in functions
Posted by stjulian at 5/24/2005 12:00:00 AM
I can't seem to get the nesting correct for an IF THEN condition inside a
function. My intent is to return the results (a table) of one of two
dfferent complex select statements. And, really, I am porting this SELECT
over from a working stored procedure. I wanted the convenience of being able ... more >>
SQL Service do not release memory
Posted by Bassam at 5/24/2005 12:00:00 AM
Hello All,
I have a vb.net application that connects to local SQL Server 2000+SP3 DB
server has 1.5 GB RAM, if server just restarted then at end of first day
memory consumption for the service is 600 MB , fine, even though at night no
one still connected to the server , memory does not release... more >>
create procedure for 'search agent'
Posted by The Gekkster via SQLMonster.com at 5/24/2005 12:00:00 AM
Hey all,
Just when I thought I was starting to get the hang of T-SQL, I try a
project that now (after several failed attempts) has me thoroughly
confused. I'm trying to create a procedure for a 'search agent' that will
execute users' saved searches and generate email notifications via
xp_smtp... more >>
Insert into linked SQL server
Posted by Nikola Milic at 5/24/2005 12:00:00 AM
Hi,
What is the fastest way to insert about 1000 rows from one SQL Server into
another over linked server?
I'm using SS2000 Enterprise edition SP3 on Win2000 Advanced Server SP4
Thanks in advance
Nikola Milic
... more >>
Command line parameter passing
Posted by Guy Dreger at 5/24/2005 12:00:00 AM
Command line parameter passing
Does anyone know if it is possible to pass a parameter to a script run
from the isql (Query Analyzer).
I have a large .SQL file that does a setup of a database and I would
like to pass it a parameter that is
A name of another database to create some views to.
... more >>
Delete Lock
Posted by kfu at 5/24/2005 12:00:00 AM
Hi,
I'm trying to clean up some old mess. We've got an sql server that keeps
reporting deadlocks. There is a loging application that keeps inserting
and deleting records from a table. The delete statement will always delete
only 1 row. The table is without primary keys and indexes. My qu... more >>
Select until sum
Posted by simon at 5/24/2005 12:00:00 AM
I have table Order with value column, date column, ....
Is it possible to select all orders while sum(value)<1000 order by date
column.
Something like:
SELECT * FROM orders
while sum(value)<1000
order by date
Hope you know, what I mean.
Regards,Simon
... more >>
SqlMoney or Decimal
Posted by Ados at 5/24/2005 12:00:00 AM
Hi friends,
Sorry for my not very good English.
I am new in sql server.
I am using sqlmoney to represent the price. First of all I am not sure is it
good idea or I have to use decimal?
And my second question is haw to cut the last 2 digits of sqlmoney (I mean
for example 12345.1200 t... more >>
Bogus "Invalid object name" error
Posted by Jerry at 5/24/2005 12:00:00 AM
Hi all,
I'm posting this so it'll be archived in the great google
repository, and hopefully be useful to someone. I spent awhile
troubleshooting what turned out to be a completely misleading error
arising from a simple typo in a query. Here's the crux:
---
create table foo (id int)
... more >>
Query question
Posted by Simon Abolnar at 5/24/2005 12:00:00 AM
I have two tables:
Table1: IDTable1
IDTable21
IDTable22
Table2: IDTable2
Data1
IDTable21 and IDTable22 are connected with IDTable2
Is it possible to write a query to display Data1 for IDTable1 and IDTable2 ?
I know that it is possible to do, but on... more >>
Unable to debug
Posted by lara at 5/24/2005 12:00:00 AM
Hi,
I have a problem wille debugging the SPs. Its showing error when i run the
service on my loginname. 'Error id 5; Access Denied' .
Then I add my login in admingroup and then restared the service. Now the
service is ok, but debugging is not working, instead of debugging, it just
runs the whol... more >>
|