all groups > sql server programming > april 2005 > threads for tuesday april 19
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
find the best way
Posted by js at 4/19/2005 11:05:10 PM
hi,
i have a query like this:
select id from jointbs where1
union
select id from jointbs where2 and id not in (select id from jointbs where1)
is it any good way to handle this case? thanks...
... more >>
find fields
Posted by js at 4/19/2005 10:29:58 PM
hi, how to find the fields have "&abc" as the caption in the database?
thanks...
... more >>
Help needed in an Updation Query
Posted by Boomessh at 4/19/2005 10:20:02 PM
Hai ,
Can any one of, out there help me in the following query.
I have two tables, one table has to get updated with sum of another tables
value. (Explanation below:)
Is it possible to use a single update statement, (i have done it with using
cursors)
Explanation:
Table A:
Col... more >>
perplexed by queries
Posted by Scott at 4/19/2005 8:50:01 PM
I have a database of patients visiting a doctor.
Each patient has personal info in a PATIENT table
Each visit has visit info in a VISIT table, linked to the patient table
Each surgery performed has an entry in the SURGERY table, linked to the
visit table (because some visits have multiple sur... more >>
Query Tuning
Posted by Rafael Chemtob at 4/19/2005 7:35:50 PM
Hi,
I have a query that selects 4 fields. One is of type Varchar(500). When I
execute the query, the response is about 9 seconds (very slow). When I
comment out the varchar field, it returns in less than 1 second.
It took me a while to figure out that it's not a missing index, i can't
figure... more >>
IFilter and SQL Server Fulltext Search
Posted by Sathian at 4/19/2005 7:27:39 PM
Hello,
How can we use an IFILTER integrated with SQL Server Fulltext Search?
Should it be installed on SQL Server Machine? Any specific programming
required to utilise the service of IFILTER?
After installation any configuration has to be done?
Any guess in this regard would be of high help... more >>
Tools to analyze SP
Posted by Kenny M. at 4/19/2005 6:27:02 PM
hi
I have 40 SP, most of them are symple, but I want to get the most
What tools can you recomend to analyze my SP and get suggestions about
performance?
thks... more >>
how to get disk total space info?
Posted by JJ Wang at 4/19/2005 6:24:02 PM
hi all,
I know that master..xp_fixeddrives can give you the free space info for each
drive on your sql server.
but is there any proc that can return the total disk space?
also, anyone know how to see the code inside of master..xp_fixeddrives?
many thanks!!
JJ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
HOWTO: Format a Numeric field in a SQL Query???
Posted by Rui Macdonald at 4/19/2005 5:48:11 PM
I need to format a numeric field in a SQL Query in order to obtain the
result that is going to be on a repeater on a aspx modulo.
Can you help me and give me an exemple.
The field is Product.PublicPrice.
Regards
Rui
... more >>
delete record does not exist in table
Posted by Souris at 4/19/2005 5:31:01 PM
I want to delete records in table1 if account number does not exist in table2.
I have following code:
DELETE FROM TABLE1
WHERE ACCOUNT_NUMBER not in(SELECT ACCOUNT_NUMBER FROM TABLE2)
Should the above code work?
Any informaion is great appreciated,
... more >>
add coments to my comments
Posted by Souris at 4/19/2005 5:28:02 PM
I want to accumulate user's comment to exists comments.
For example
Updatte mytable
Set Mycomments = MyComments + @Mycomments
Where mytbale.account_number = @MyAcountNumber
I always get blank if I add MyComments + @Mycommetns.
The code works if I have @myCommnets.
Any suggestions for... more >>
Importing from Access question
Posted by amber at 4/19/2005 5:26:01 PM
Hello,
I have a SQL Server database that was created by importing an MS Access
database.
In one of my SQL tables I have added several fields, and have populated some
of these fields with data.
Is there any way to create a DTS package, or do a straight import, where I
pull all records from... more >>
Do While Loop in T-SQL?
Posted by Raterus at 4/19/2005 4:57:02 PM
Is there a way to construct a Do While Loop in T-SQL. I didn't see any =
syntax in BOL for doing this. Essentially, I want to always run the the =
loop once, then check the loop expression to see if I can exit. In VB =
it would look something like this
Do
...
Loop While(something < 5)
... more >>
LEN
Posted by Jaco Wessels at 4/19/2005 4:55:55 PM
Hi
I have a view that uses LEN.
My problem is that it brings back all instances like it should do, I need to
filter the instances on the reference column so that it will only display
one instance of a particular record?
------- view ------
ALTER VIEW qfmRepReferenceLookup AS
selec... more >>
analysis services installation trouble.
Posted by Trisha at 4/19/2005 4:16:02 PM
I am posting this question here because I got absoultely no help in the olap
section.
Please excuse me for posting here but I had no choice because I got
absolutely no response there.
TIA and please help..
I am having trouble installing sql server analys services (olap) on windows
x... more >>
trigger permission (error)
Posted by culam at 4/19/2005 3:35:02 PM
I created a trigger to update changes in a column and it works fine when I
execute in Query Analyzer,
But when user update data thru third party application, the trigger fail to
fire. Is there a permission issue relate to trigger. If I drop the trigger,
the user can update data.
Thanks,
... more >>
how to increase buffer size
Posted by Britney at 4/19/2005 3:26:42 PM
hi,
I used dbcc perfmon to find out free buffers from my local server
....
Free Buffers 12449.0
Now I want to increase buffer size, how to do that?
... more >>
Tricky Transact Question Columns / Rows
Posted by quiglepops at 4/19/2005 3:10:15 PM
Hi All,
I have a transact query which returns data in the following format....
Firm Product Total
-----------------------------------------------
FirmA P1 100
FirmA P2 2... more >>
Is this a bug? Interaction between REPLICATE and database collati
Posted by Steve Shaw at 4/19/2005 2:41:04 PM
I have the following reproduction script:
================ BEGIN ================
-- the default collation of the SQL Server instance is assumed to be
SQL_Latin1_General_CP1_CI_AS
USE master
GO
IF EXISTS (SELECT name FROM sysdatabases WHERE name = N'BugTest')
DROP DATABASE BugTest
GO... more >>
Query Help ...UDF..
Posted by craig NO[at]SPAM themurrays.org at 4/19/2005 2:00:10 PM
where @respondantinput is being generated I need to check if inputid = 38
then join to Calendar cal on inputid = cal.event_id and return
cal.event_title instead of the @respondantinput of a number.
I am not sure how to add the check for inputid=38 when the cursor just
selects the respondantinp... more >>
Query to find record selection on between dates
Posted by RD at 4/19/2005 1:50:41 PM
Table has five fields fields
PrimaryKey - Integer type
InfoField1 - String Type
InfoField2 - String type
StartDate - DateTimeType
EndDate - DateTimeType
My where clause should be something like
Where InfoField2 = 'something' And Today's date between S... more >>
CURSOR to delete from multiple table
Posted by Troy Jerkins at 4/19/2005 1:45:06 PM
I'm trying to declare a cursor that gets a list of tables in a databse and
then deletes all the data from them. My problem is that SQL will not
recognize
the variable as a table name. Is there another way to do this or perhaps
some different syntax use?
Here are my statements
declare @t... more >>
Bit field true/false
Posted by David C at 4/19/2005 1:37:24 PM
When I code my SQL statement and want to check equal condition on a bit
field, should I use True/False or 1/0?
David
... more >>
Accessing #temp table in a proc as a user with minimal rights.
Posted by Mike Malter at 4/19/2005 12:43:51 PM
I need to create a #temp table in a proc as a user with minimal rights and then
insert into it and select from it.
However, I am getting an error telling me that either the table does not exist or I
do not have sufficient rights to access it.
How do I get around this rights problem?
Tha... more >>
Can a trigger determine its name?
Posted by Vadim Rapp at 4/19/2005 12:35:29 PM
Hello,
is it possible for a trigger or stored procedure to determine its name?
thanks,
Vadim Rapp... more >>
History Cross-Tab via Cursors
Posted by hogwart at 4/19/2005 12:26:02 PM
I have a table with a PK of id and timestamp, plus other variables: an
update of a row adds another row with the same id but a later timestamp. I
need to create a report that lists the variables that have changed. The
following proof of concept code works fine, but I was wondering if the sa... more >>
FOR loop
Posted by Srikant at 4/19/2005 12:24:02 PM
Why does'nt SQL Server 2000 support For loop conditional statements? I know
While and IF's are there, but what made Microsfot not include a For loop?... more >>
What is the best approach?
Posted by Andrew at 4/19/2005 11:30:01 AM
Hi, friends,
I need to write a stored procedure to return records selected from 2 tables.
However, before returning those records, values of some fields need to be
recaculated with up-to-date data in some other tables of the same database,
and the original field values in that 2 tables shou... more >>
Date conversions and arithmetic
Posted by hbcp_1 at 4/19/2005 10:57:03 AM
Hi folks,
New to SQL programming and reading about CONVERT, CAST and the DATE
functions aren't giving me enough info. to solve my problem.
My data looks like this:
20050416000000 Admitted 33
20050416000000 Discharged 26
20050416000000 Registered 70
20050417000000 Admitted 33 ... more >>
Odd Query Request
Posted by Brian at 4/19/2005 10:55:10 AM
This may be an odd request. I am trying to write a function or stored proc
that will accept a tablename.
It will then query and return the columns of the table:
select c.name from syscolumns c
inner join sysobjects o on c.id = o.id
where o.name = '<table_name>'
Next take those result... more >>
time series problem
Posted by tonybaloneyman at 4/19/2005 10:37:37 AM
I am trying to write a stored proc the calculates a moving average over
three periods. In the following example, I need to stratify the data by
DetailID in the #Temp table, but I am not sure how to do
it without using a cursor to limit the cross join to a single detailID
at a time.
What I want ... more >>
return replicated rows
Posted by AKC2005 at 4/19/2005 8:38:01 AM
I have a table with two columns. I want to return the rows that are found
twice in a certain column.
Ie.
Col1 Col2
1 a
1 b
2 c
3 d
4 e
For I want a script that will return 1 (because it is found more than once
in Col1)
Would greatly appreciate that help
... more >>
Tricky Stored procedure
Posted by bagman3rd at 4/19/2005 8:32:03 AM
I am tring to build a stored procedure to query an Excel spreadsheet. The
name of the spreadsheet will change every time. I would like to pass the
path/filename into my query as 1 parameter and the worksheet name as another
parameter, but I am having problems because
a. SQL server does not... more >>
Grouping by Month wise
Posted by siaj at 4/19/2005 7:59:05 AM
Hello all,
I have a table Policy with Column as
EmployeeName PolicyName Date
Jon PolA 01 Apr 2004
Jon PolB 02 Apr 2004
Bob PolB 02 Apr 2004
Randy PolC 02 Jun 2004
I want a resultest as ... more >>
sql_variant type
Posted by Roy at 4/19/2005 7:56:01 AM
Here is a definition for sql_variant data type copied from SQL Server books:
A data type that stores values of various SQL Server-supported data types,
except text, ntext, image, timestamp, and sql_variant.
MIDL also defines VT_ARRAY for COM data types, shch as VT_ARRAY | VT_UI4.
Can sql_va... more >>
Problem INSERTING duplicate Rows
Posted by andrew NO[at]SPAM thevalley.f9.co.uk at 4/19/2005 7:28:52 AM
I'm trying to populate a temporary table with unique data, however my
populating query produces duplicated data. I've tried using a sub query
(i.e. querying the temp table during the INSERT to see if the data
already exists), but that doesn't stops the primary key violation
error. I've included ... more >>
Last Day of Month Function
Posted by j at 4/19/2005 7:00:03 AM
Hello all,
I am trying to avoid using wordy logic to get date values meeting criteria
for the last day of the each month in a date field. Is anyone aware of a
last day of the month function? I know that Oracle offers this.
Thanks for your help.
J.... more >>
Db Error 10039
Posted by rvivekraj at 4/19/2005 6:15:02 AM
When executing a Stored Procedure i am getting error 10039
"Attempt to convert data stopped by syntax error in source field"
intermittently
Can anyone tell me why this happens or resolution for this issue
--
vivek
Chennai... more >>
kill process id with host
Posted by Jamie Elliott at 4/19/2005 5:57:02 AM
I need a script to kill several process ids by a certain host.....need help
ASAP...thanks... more >>
Help expanding a query .. group By
Posted by Peter Newman at 4/19/2005 4:23:02 AM
Im using vb code to generate a SQL query to return a recordset. The follwing
query returns 2 records as follows.
Select a.BHYEAR_MOVEDATE,
Case b.BTYear_TransCode
WHEN '17' THEN 'DD'
WHEN '01' THEN 'DD'
WHEN '18' THEN 'DD'
Else 'AUD' END AS 'TYPE'
from dbo.BacsHdrYearly as a
... more >>
is it a bug?
Posted by POKEMON at 4/19/2005 3:13:02 AM
it is the second time i am writing this problem.
I have a view named x_vw and while ı exec it as
select * from x_vw where field1='a1'
it returns the results which are field1='a1' but when I exec the query as
select * from x_vw
it returns all results but eccept the results which are field1='... more >>
SQL Statement Performance
Posted by Ricky Chan at 4/19/2005 2:57:01 AM
I have a batch SQL Statement.
---
Part 1
Create Serveral Temp Table
Part 2
Open Cursor to get the result from temp table
---
If I run part 1 and part 2 together, then it spends 28 sec.
However, If I run two part independently, then
Part 1 spends only 1 sec
Part 2 spends only 2 sec
A... more >>
"Drop Table" at Stored Procedure
Posted by nieurig at 4/19/2005 12:09:01 AM
Hello folks,
i like to change a sql-skript to a procedure. The skript includes 20
statements like
select ... into #temp
and
drop table #temp
It runs as a batch if i use
drop table #temp
go
In order to change it to a procedure i change all "drops" to
drop table #temp;
but i... more >>
sql injections
Posted by Adam K at 4/19/2005 12:00:00 AM
HI,
I've got simple question.
Is it enough to prevent sql injections if I transform all ' in ".
What else I have to do?
Thanks
... more >>
Suggestions and Thoughts
Posted by scorpion53061 at 4/19/2005 12:00:00 AM
I am new to writing stored procs. This is attempting to have two dates
and it is suppose to pull all records between the two dates. They are
both datetime values. I would appreciate any suggestions if the
QUOTEACTIONDATE was actually varchar.
Any changes or suggestions you might add would b... more >>
FK Problem
Posted by Bruno N at 4/19/2005 12:00:00 AM
Good Morning everyone,
I stuck :( Need your help please.
Im creating a table called Bills, where it should have a FK saying to who
this bills belongs. I cant do it, because i have two different tables,
person and company (in the following code company and person only have the
PK and the ... more >>
Querying View lasts ages...
Posted by news.sunsite.dk at 4/19/2005 12:00:00 AM
Hi all,
I am currently experiencing a strange behavior when querying a view.
If I query it unsing
WHERE TheDate BETWEEN '10/1/2004' AND '9/31/2005'
it takes about 20 seconds to return a result.
When using
WHERE TheDate BETWEEN '10/1/2004' AND '9/31/2004'
which is a much shorter period... more >>
Method to check the connection status of any Machine on Network
Posted by adnankudiya at 4/19/2005 12:00:00 AM
Hello All:
I need to know the connection status of any machine on domain i.e. I
want to check that whether the machine is on or off(alive/dead).
If anyone can tell then I shall be highly grateful
Sincerely,
Adnan Kudiya
--
adnankudiya
-----------------------------------------... more >>
total in the same procedure
Posted by alecarnero at 4/19/2005 12:00:00 AM
how can i make a sum of total put this result in an output variavel in this
store procedure???
ALTER PROCEDURE dbo.tcaixa1(@inicio datetime,@final datetime)
AS SELECT TOTAL, DATA, CAIXA FROM dbo.precaixa
WHERE (DATA >= @inicio AND DATA <= @final)
thanks in advance by an... more >>
GetString in SP
Posted by DMP at 4/19/2005 12:00:00 AM
Hi,
Alternate of Recordset.GetString() in Stored Procedure !
... more >>
What processor am I running on?
Posted by Graham Morris at 4/19/2005 12:00:00 AM
Can I (in T-SQL) find out the name of the processor a clustered instance of
SQL Server is currently running on? Serverproperty('MachineName') only
returns the cluster alias.
---
Graham
... more >>
SQL Server and Visio
Posted by Sathian at 4/19/2005 12:00:00 AM
Hello,
Is it not possible to create tables in SQL Server database from a Database
Model Diagram of Visio?
If yes, how to do it? can somebody help?
Warm Regards
Sathian
... more >>
|