all groups > sql server programming > july 2003 > threads for wednesday july 23
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
Query to find names in 2 tables
Posted by Danny Springer at 7/23/2003 11:29:13 PM
Is there a possibility to find names in 2 tables with one query? The
tables are not related.
Table1:
CustomerNr int(4)
Name Varchar(70)
Table2:
CustomerNr int(4)
Name Varchar(70)
table1: 33 Danny
47 John
59 Mary
table2: 137 Peter
12 Mary
... more >>
STUCK, help??
Posted by gv at 7/23/2003 10:26:54 PM
CREATE TABLE dbo.Table1
(
INS nvarchar(50) NULL,
INS_AMT money NULL,
PAT_AMT money NULL
) ON [PRIMARY]
GO
Insert Into dbo.Table1( INS, INS_AMT, PAT_AMT)
Values ('MCARE', 80, 20)
Insert Into dbo.Table1( INS, INS_AMT, PAT_AMT)
Values ('BCBS', 90,10)
Insert Into dbo.Table1( INS, INS_AM... more >>
obscure error
Posted by jlongino at 7/23/2003 9:34:56 PM
We are getting the following error logged inthe NT evelt log by SQL server
in relation to an ODBC app calling a stored proc. I can't seem to track
down any good detail on what it may mean. I fear database corruption of
some sort.
"Could not open FCB for invalid file ID 22017 in database 'M... more >>
What is a hash table ?
Posted by Tim Conner at 7/23/2003 9:26:17 PM
The BOL mention that a hash join creates a "hash table" to resolve the join.
But what is a hash table ? it is just like a temporary table ?
Additionaly, could you give any recommendation about links, books or
articles that widely explain the different join algorithms ?
Thanks in advance, ... more >>
collation
Posted by Fred Zilz at 7/23/2003 9:23:49 PM
I have a database that use collation latin1_general_ci_ai
I need to copy some table from it to a database that is
collation sql_latin1_general_ci_ai. I was getting some
collation errors. So I converted my database to
latin1_general_ci_ai, and change the tables individually
to the same col... more >>
Divide by Zero Query
Posted by Pitoyo at 7/23/2003 9:03:34 PM
Hi..all,
How to solve divide by zero error when I need to display
all records in query?
Example:
Name Sales Target
A 50 0
B 100 50
C 0 50
The query should resulting records like this :
Name Sales Target Ach
A 50 0 0
B 100 50 200
C 0 50 ... more >>
Storing Video files to a database
Posted by patel_o at 7/23/2003 8:50:25 PM
Hi All
I am working on an application which captures streaming videos and
record them onto a hard drive. The exact directory where the videos will
be saved can be configured through application.
The application works like this:
- There are multiple security cameras streaming videos to a... more >>
Gurus: Impossible task? Work around for not having FIRST() aggregate function...
Posted by Daisy at 7/23/2003 8:00:51 PM
I've been scratching my head over this for hours, and I'm amazed I've not
found a solution, when it's incredibly simple with Access' FIRST() function.
Sorry, got no SQL here, so no CREATE TABLEs, but here's a quick idea and
description
item
item_key | name
1 Item 1
2 ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
refer to a SELECT statement twice
Posted by Zhang Weiwu (family name first) at 7/23/2003 7:10:51 PM
newbie question again;)
Here i designed a view like this:
SELECT ********
UNION
SELECT ********
(I cannot put the two SELECT into one because I am using
very different way of calculation in the two SELECTs)
Both the first and the second SELECT statement refer to
an another very compl... more >>
reports
Posted by David Mainzer at 7/23/2003 6:23:27 PM
Hey all,
Does anyone know how to develop reports based on SQL
Server database in ASP? Is it possible to integrate
Crystal Reports into ASP code?
thanks
david... more >>
t-sql
Posted by sri at 7/23/2003 6:11:24 PM
Hi
I have table with below sql.
Is there any way we can get result with hori.....
and also with out creating temp tables or perm tables in
one select statment.
Thx
create table test (month1 varchar(10),num int)
insert test select 'march',3
select * from test
month1 num
-... more >>
SELECT between two Dates ??
Posted by Andreas Klemt at 7/23/2003 5:08:20 PM
Hello,
I have this
Table: dates
------------
id begindate enddate
1 07/01/2003 09/01/2003
2 06/01/2004 11/01/2004
3 04/01/2005 12/01/2005
Now I want to do a SELECT to find out if
from date1=11/11/2003 until date2=11/20/2003
is in Table dates.
How can I do this?
T... more >>
store procedure modify date
Posted by Mike at 7/23/2003 4:51:39 PM
how to find out the latest store procedure modification date?
... more >>
Triggers & Inserted Data Length...
Posted by Greg at 7/23/2003 4:29:17 PM
Is it possible to get the value of the length of data being inserted into a
table by using a trigger?
What I'm looking to do is keep track of how much database space a user is
using so I was thinking of tracking the amount of data being added to the
tables using a trigger (which would update t... more >>
sytax problem
Posted by Andrew Dunbar at 7/23/2003 4:03:42 PM
I'm not allowed to use outer join operators in a query containing joined
tables. Any suggestions?
select
u.FIRSTNAME First_Name,
u.LASTNAME Last_Name,
count (*) Objects_Published,
ui1.INFO City,
ui2.INFO Organization_Name,
ui3.INFO Organization_Type
from
User... more >>
Cursor Question
Posted by Venkatesan M at 7/23/2003 3:22:37 PM
hi folks,
Is there any way to assign a cursor to another cursor like how we assign a
variables value to another variable...
thanks in advance
... more >>
Email Records from View
Posted by Greg at 7/23/2003 3:14:12 PM
Hello,
I am running SQL 2000 with Exchange 2000. I have created a view with the
following columns:
ID# Address ListAgent ListAgtEmail CloseDate (where CloseDate <=
DATEADD(d, -5, GETDATE()))
What I would like to do is when I update the table every night, and a record
shows up in th... more >>
Copy tables without using checkbox......how??
Posted by Joe M at 7/23/2003 3:03:23 PM
How do I created a DTS or TSQL package that automatically copy tables
starting with [DG*], there will be 100 tables starting with DG. I don't
want to manually select the tables with their checkboxes. What I want is a
script that will copy the tables based on the first 2letters of their name
(D... more >>
Update on SQL database with stored procedures in another SQL database
Posted by M at 7/23/2003 2:32:09 PM
Hello. I have a question largely expressed in the title. I wish to update
tables (records) in one SQL database using stored procedures in another SQL
database. Both databases would be Microsoft SQL Server 2000 databases and
may or may not be running on the same server (physical computer) or in... more >>
Deadlocking problem
Posted by Marina at 7/23/2003 2:27:11 PM
Hi,
We have an application that does updates and inserts to a database, which
multiple users could be using at once. We are encountering a deadlocking
problem, when 2 users are trying to do something at the same time.
These are just very simple inserts/updates. They are going to the same
t... more >>
change owner of all objects
Posted by LP at 7/23/2003 2:21:01 PM
I have the following script from the archives, which i've modified slightly.
I need to make sure that this changes object owner to dbo for all objects
that are not owned by dbo or INFORMATION_SCHEMA.
Can you guys have a quick look and verify this script? Any help appreciated.
Thanks.
DECLAR... more >>
do i need a stored proceedure?
Posted by Andrew Dunbar at 7/23/2003 2:13:35 PM
I have 2 tables- users and objects
I would like to run a report having users.firstname, users.lastname, and the
count of objects published in objects by the user:
FIRSTNAME LASTNAME OBJECTS_PUBLISHED
Fred Smith 74
Joe Clark 4
Don Pardo 102
Ideally, I would like to do this with a sql que... more >>
Specifying Numeric datatype in a SP
Posted by Craig G at 7/23/2003 2:12:45 PM
i have a field named Corporate Amount
the field is of datatype Numeric, size 5, precision 9, scale 2
how do i specify an input parameter in a stored procedure to handle the
above
at the minute i have it as follows:-
@CorpAmount as Numeric(5)
but if i add the parameter via VB it drops t... more >>
Need help about stored procedures
Posted by Tahir Emre KALAYCI at 7/23/2003 1:02:49 PM
Hi all.
I want to send table name to stored procedure and use this tablename in
select into query to be able to select some values into this table.But this
table isnt created yet and gonna be created by procedure.I tried this proc
code but not worked:
---------
CREATE PROCEDURE testproc @... more >>
CASE
Posted by Eric at 7/23/2003 11:52:40 AM
Hi,
I have a stored procedure that I find a little bulky. I'm
new to SQL programming, but from what I can see there must
be a way to simplify the code I have written:
--------------------------------
CREATE PROCEDURE STRDPROC_ACTIONLOG
@tpName VARCHAR(255),
@tblName VARCHAR(20),
@tri... more >>
SQL-DMO(ODBC SQLState:) Error 0: message
Posted by Mike at 7/23/2003 11:50:41 AM
Hi all,
when I highlight a table, then right click the mouse , go to all task,
go to generate sql script, I got
SQL-DMO(ODBC SQLState:) Error 0: message.
someone please help me out....
... more >>
Selecting by time slots
Posted by Matt Lemon at 7/23/2003 11:50:20 AM
Hi,
I'm writing a conference room booking system for our corporate intranet and
I want to create a stored procedure that takes the start datetime, finish
datetime and room number as input parameters and then either returns a table
showing the conflicting reservations or adds the data into the ... more >>
size / char of text
Posted by hngo01 at 7/23/2003 11:46:11 AM
Hi, I have table that has a column Data (datatype is
text). Is there a way to see the size / characters for
each row? Thanks... more >>
Searching on Day/Month Portion of DateTime
Posted by George Durzi at 7/23/2003 11:40:31 AM
I have a USERS table with a Birthday column as shown below (create statement
significantly trimmed down for simplicity)
CREATE TABLE [USERS] (
[ID] [int] IDENTITY (1, 1) NOT NULL ,
[BIRTHDAY] [datetime] NULL ,
CONSTRAINT [PK_USER] PRIMARY KEY CLUSTERED
( [ID] ) ON [PRIMARY]
) ON [PRIM... more >>
Case statement help
Posted by Meenal Dhody at 7/23/2003 11:01:12 AM
Currently I have a Case statement in an update statement that looks like
this:
update #MeetingsTmp set MeetingCount =
(select count(*) from meeting m
where m.companyid = mt.companyid
and m.MeetingDate = mt.MeetingDate
and MeetingTypeID = (CASE mt.MeetingType WHEN 'A' THEN 0
WHEN 'C' ... more >>
Character Fields to numbers?
Posted by Bethany Holliday at 7/23/2003 10:41:17 AM
Hi All,
I have a table that has a field defined as char to allow for both
numbers and text to be stored. Is it possible for me to run a select
statement that will select out just the records that can be convered to
a number format?
Example - 1 record may have N/a stored in the cell, 1 reco... more >>
Temp tables within stored procedures
Posted by Kurt Gerrild at 7/23/2003 10:15:20 AM
We have several stored procedures that use #temp tables.
I have found that if I place the creation of these temp
tables within a 'parent' stored procedure and then call
the original stored procedure to do all of my processing,
this drastically increases the speed of my process. For
examp... more >>
Query Analyser - Getting hold of a copy
Posted by Chris Strug at 7/23/2003 10:01:01 AM
Hi,
I'm currently working on an Access ADP project linked to a database held on
a SQL 2000 Server.
AT the moment, to use the query analyser I have to work on the server which
is a pain and something I'd rather not be doing.
Is it possible to use Query Analyser on a client machine? Can I g... more >>
FULL-TEXT CATALOGS
Posted by Simon at 7/23/2003 9:59:08 AM
I would like to include index search in my program, but I can't find
FULL-TEXT CATALOGS option in my database.
This should be present when you click on database in enterprise manager
Does anybody know where I should look? Is this some setting in SQL?
Should I install SQL server again, but I do... more >>
How use Subquery better ???
Posted by lubiel at 7/23/2003 9:42:13 AM
Hello,
Someone knows how i can do a select query where
I do match between rows ???
For Example, suppose that I have a Table like is:
** Table1 **
FA-FB-FC-FD
-----------
41-X-W-8
41-X-M-NULL
41-Y-N-10
Suppose that Customers is another table which
I am going to apply the query.
... more >>
multiple inserts and updates using variables
Posted by Phil at 7/23/2003 9:08:26 AM
I need to apply multiple inserts into a table,
however if the insert violates a pk violation
I need to perform an update. I have a sp
which is passed the tablename, columns, and
values. I have split up the column names and
values into two seperate tables and each table
should have the same nu... more >>
lost my ref to this "do's and don'ts for ado.net" (x-post dotnet languages adonet)
Posted by jobi at 7/23/2003 8:26:33 AM
Hi, (sorry for the x-post)
I've lost my printed form of a www-ref for "do's and don'ts for
ado.net" This doc explained very well the use and usage for the
different ado.net objects and the concept for the way they should be used.
I cannot find it on the net.
Any hints ?
jobi
... more >>
SQL Counting Records from another Table
Posted by nick NO[at]SPAM cricketsupplies.com at 7/23/2003 7:57:58 AM
Dear all sql fans, I have a query
Table A
catid catname
1 Fred
2 Ginger
3 Rogers
4 Dancing
Table B
id catid
1 2
2 2
3 3
4 2
Is it possible using sql to get the result
Fred 0
Ginger 3
Rogers 1
Dancing 0
SQL counts gives (1's) inst... more >>
Foreign Key help
Posted by Ben at 7/23/2003 7:46:25 AM
I am tring to creat a Foreign key relationship after a
table has already been created. I want the option
for "enforcing relationships for replication" and
for "enforce relationships for inserts and deletes turned
off.
Here is my code presently. THanks.
ALTER TABLE [dbo].[permits] W... more >>
Using ISNULL in Dynamic SQL
Posted by barrygilbertusa NO[at]SPAM yahoo.com at 7/23/2003 7:26:10 AM
Hi,
I have dynamic sql in a sproc that takes a few optional parameters.
One of the parameters is an NVARCHAR and it's default value is NULL.
In the dynamic query string I check for null so that if the parameter
is not passed, I can get all records. Something like this:
Alter Procedure MySpr... more >>
set @iValCount = exec(@sSQL) ... ERROR
Posted by Anders at 7/23/2003 6:13:41 AM
Hi
I have this code:
....
Declare @sSQL nvarchar(1000)
Declare @iValCount int
set @sSQL = '(SELECT count(id) FROM
it_reg_utrustning_kringut AS kringut WHERE ' +
@sParameters + ')'
set @iValCount = exec(@sSQL)
....
The @sParameters is a string with alot of and, or. If i
just run... more >>
difficult query question
Posted by newbie at 7/23/2003 5:54:53 AM
Hi,
I need some help with a query. I have a table that
contains three columns: year (char(4)), p_group (int), and
amount (decimal(18,2)). I would like to write a query that
groups the table by p_group, sums up the amounts and
displays it according to year (like year would be the
column... more >>
Dynamic column names
Posted by John Williams at 7/23/2003 4:00:32 AM
I am using 7.0 and trying to generate a sql statement that
allows me to a select a column that is defined as a
variable.
Basically something like in a stored procedure......
Declare @column varchar (30)
Declare @value varcar (30)
set @column = 'fname'
select @value = @column from na... more >>
Stored proc help...
Posted by John Pether (john NO[at]SPAM at 7/23/2003 3:33:40 AM
I need to write a stored proc to return data from a table. The table (tblLinks) contains a column TypeID, which is related to another table (tblLinkTypes) which has two columns, TypeID & TypeName.
This is prolly v. simple stuff but sql is not my thang, I want to return all the rows that correspon... more >>
Brain Drain. Please help
Posted by holysmoke at 7/23/2003 1:31:50 AM
Hi,
I'm having a problem in grouping the following project
planning related data,
The data looks like this,
Task Resource Actuals IsTask
Planning 0
DB Schema Allen 10 1
WebDesign Raj 5 1
TestPlan Allen 3 1
Coding 0
... more >>
Need help with select statement
Posted by Don Miller at 7/23/2003 12:17:11 AM
I have a table where each row has a column representing a bill denomination
(e.g. 1, 2, 5, 10, 20, 50 or 100 dollar bill). I need a select statement
that will give me a count of the number of rows for each denomination. Any
help would be appreciated!
Thanks!
Don Miller
... more >>
Consecutive events
Posted by elwoos NO[at]SPAM hotmail.com at 7/23/2003 12:16:23 AM
I run a system that stores information on patients and when they are
seen by a doctor in clinic. So for a given clinic I may have
pk_ClinicID fk_PatientID ClinicDate PatientAttended
I need to write a query to determine if a patient didn't attend for
two consecutive clinic's. At the moment I ... more >>
|