all groups > sql server programming > august 2003 > threads for thursday august 14
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
how to index this table?
Posted by FN at 8/14/2003 11:54:41 PM
I have a table that has character ranges in it, such as
FIELD1 FIELD2
1234 1235
1235 1841
1842 1849
Those 2 fields are fixed length char fields.
I need to do queries such as
SELECT * FROM TABLE WHERE @test BETWEEN FIELD1 and FIELD2
How sh... more >>
Normalizing the world
Posted by Vincent V at 8/14/2003 10:14:19 PM
Hey im working on a worldwide system and i am trying to work out the best
approach to how i am going to Segment the world / Countries / States /
Provinces - Suburbs | Citys???
Any ideas cause i neet for people to be able to select on any level
i they may just select a Country or maybe the full... more >>
The name Not Valid Identifier
Posted by Murray Bryant at 8/14/2003 8:27:12 PM
I am trying to execute a query string in an execute command and are
getting the following error:
Server: Msg 203, Level 16, State 2, Line 55
The name 'INSERT INTO tblDHMinerals (Dataset, Hole_ID, Depth_From,
Depth_To, Code_System, Min_Code,Load_Date,
Loaded_By,Modified_Date,Modified_By... more >>
LQQLY: how do I put this exactly??
Posted by Trint Smith at 8/14/2003 6:24:25 PM
oj gave me this and I know it's gonna solve my problems (cuz he's always
right!) if I can just know how to put this in correct syntax:
1. Create a staging table:
select top 0 *
[Mink].[dbo].[TBL_Catalog_stage]
from [Mink].[dbo].[TBL_Catalog]
2. Bulk insert into stage:
sqlstr =... more >>
ADO accessing SQL data
Posted by Karen Caldow at 8/14/2003 6:23:47 PM
Dear All,
I have spent the last 6 hours and I can't figure this out but I know have to
admit defeat and seek advice from higher mortals. I am trying to post
details from an ASP web form to a SQL Server database. The data will be
posted into the database through a stored procedure. The stored p... more >>
Job Steps
Posted by Largo SQL Tools at 8/14/2003 4:50:25 PM
I would like to create a job in which one of the steps is to call another
job. Is this possible? If so, what is the syntax?
J.R.
Largo SQL Tools
The Finest Collection of SQL Tools Available
http://www.largosqltools.com
... more >>
help with query
Posted by John Pether at 8/14/2003 4:49:09 PM
I have the follwing proc but it isn't doing what I want it to:) It updates
entries for a link directory once they have been approved. I want it to
update the totalLinks column on the link category and any parent categories.
The Link Table contains a column ParentCatID which is its parents catID. ... more >>
What is the best way to copy tables and relationships
Posted by Sam at 8/14/2003 4:33:11 PM
Hi,
I have two databases -- Main database is on SQL Server 2000. I have another
database that's on MDSE 2000.
I want to take the tables, stored procedures and relationships from MSDE
database and dump all of them into the Main database on SQL Server 2000.
What is the best way to do this? ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
What is the SQL server equivalent of Instr.. i.e. True if StringX in StringY
Posted by RKD at 8/14/2003 4:31:34 PM
What is the SQL server equivalent of Instr.. i.e. True if StringX in StringY
... more >>
Convert function
Posted by Kartic at 8/14/2003 4:29:44 PM
In Short, I have Inventory table with two columns Quantity and Precision.
When I do
select CONVERT(NUMERIC(10,2), Quantity), Precision from Inventory
This works fine.
My problem is, I want numeric presision based on Precision column something
like convert(Numeric(10,PRECISION),Quantity) rathe... more >>
Column names
Posted by Steve Chatham at 8/14/2003 3:52:41 PM
I have to write a couple queries in which I build a file with product
information as the column names.
In my source table, I have rows with a product code on it. I join that to
another table with the business area, report group, and family class on it.
For example:
widget1 has a product ... more >>
HELP: SQL aggregating data...
Posted by christian NO[at]SPAM renninger.net at 8/14/2003 3:33:26 PM
Hi,
I have a question.
Let take this table:
Table1 (i int, update datetime)
with this in it:
1 01.01.2000
1 02.02.2000
2 03.03.2000
2 04.04.2000
5 05.05.2000
6 06.06.2000
6 07.07.2000
and I'd like a query to return
1 01.01.2000
2 03.03.2000
5 05... more >>
programming restore database with "share deny" poblem
Posted by jiatiejun at 8/14/2003 3:30:14 PM
I write a program for SQL Server 2000 backup and restore,
the backup is ok
but the restore can't work because share deny,
my SQL sytanx:
restore database mydb from disk='c:\myback.dat'
this program is a part of my ASP Web application,
the ASP connection is:
connstr="driver={SQL Ser... more >>
SQLDMO Create Table and Refresh Issue
Posted by Frank Cheng at 8/14/2003 3:20:31 PM
Hi all,
I plan on adding about 10000 tables in a database
using SQLDMO. I did the following steps for a 10000 times.
1) Create the table using Database.ExecuteImmediate
2) Refresh the Tables Collection Object
3) Get the Table object, use ImportData to bulk copy the data to the
database
4)... more >>
Stored Procedure runs slower than Select
Posted by Jory at 8/14/2003 3:11:25 PM
I have a very large SELECT query (involves over 20 inner
and/or outer joins with a couple of subselects thrown
in). I have executed this query in Query Analyzer
directly and then I have wrapped it in a stored procedure
and executed it. Direct execution of the query returns a
resultset in... more >>
Count number of records
Posted by Raul at 8/14/2003 3:05:41 PM
Hi,
I'm using SQL Server 2000. When I return all rows from a table
it doesn't give me a count of the number of records, like in
Access for instance.
Is there a way of quickly finding out how many records there
are in a table?
thanks.
Raul.
... more >>
select count(distinct col1, col2) from table
Posted by Mats Olsson at 8/14/2003 2:51:45 PM
I need to know the number of distinct col1, col2 pairs in a table. The
following does not work:
select count(distinct col1, col2) from table
This one does not work either:
select count(*) from (select distinct col1, col2 from table)
I do not want to use a view.
Does anyone know a solution ... more >>
CASE statement bug with strings!?
Posted by Simon at 8/14/2003 2:17:41 PM
I just ran into a peculiar behaviour on MS SQL Server 2000 (Std.)
Microsoft SQL Server 2000 - 8.00.760 (Intel X86)
Dec 17 2002 14:22:05
Copyright (c) 1988-2003 Microsoft Corporation
Standard Edition on Windows NT 5.0 (Build 2195: Service Pack 3)
The CASE statement truncates a returned s... more >>
Trigger inserted table -> #temptable (for use in Execute)
Posted by Murray Bryant at 8/14/2003 1:56:16 PM
I am using dynamic queries and am having problems passing the values
from the inserted table ( in a trigget ) to my exec(@sql) statement.
I am currently trying to make a temp table that is accessable from
within a execute statement. eg.
SELECT * INTO #tempInserted
FROM inserted
Ho... more >>
Plzzzz tell me why this don't keep working
Posted by Trint Smith at 8/14/2003 1:15:23 PM
This stops when it finds a duplicate record. What 'easy' thing can I do
to get it to just skip the duplicate row and continue with the rest of
the file?
sqlstr = "BULK INSERT [Mink].[dbo].[TBL_Catalog]" + _
" FROM '\\Server05\c\Catalog1.txt' WITH
(CHECK_CONSTRAINTS, FIELDTERMI... more >>
Stop first value from repeating until it changes
Posted by noon at 8/14/2003 12:57:19 PM
is there a way to stop the first value from repeating
until it changes.
EMLOYER EMPLOYEE NAME
Test1 Jane Doe
Test1 Joe Smith
Test2 Larry King
Test2 Mary Kin
What I want it to look like is this
EMPLOYER EMPLOYEE NAME
Test1 Jane Doe
Joe Smith
Test2 ... more >>
Difficult Parent Child SQL statement
Posted by Mark Frank at 8/14/2003 12:43:12 PM
Hi all,
I was curious if anyone has an example that would compare
the same PC hierarchy one month against another to see
which children had new/different parents. I.e. EmployeeA
in January rolls up to EmployeeB. In February EmployeeB
is fired and EmployeeA now rolls up to EmployeeD. I ... more >>
Dynamic Parameters in SP
Posted by Shane at 8/14/2003 12:27:14 PM
Hi all,
I was wondering if there is a way to pass a set of parameters into a SP
where the number of parameters is not always fixed? For example, if I am
updating a user, I could either pass in all of the parameters (username,
password, address, phone) or just update 1 or 2 (address). Is ther... more >>
Inner Join error: exposed names need correlation
Posted by J. Muenchbourg at 8/14/2003 12:15:23 PM
I need to match firstname, lastname in two different tables so that i
can check to see if an account has expired (tblcustomer has the
'expires' date):
exsql = "select
tblcustomer.Firstname,tblcustomer.LastName,tblUsers.Firstname,tblUsers.L
astName,tblcustomer.expires from tblCustomer INNER J... more >>
Script many tables to new filegroup
Posted by stingrays NO[at]SPAM mindspring.com at 8/14/2003 12:02:08 PM
I have 100s of tables that have the same prefix and I want to move
them to a new filegroup. Is there a method to use a variable in an
ALTER TABLE statement to build the table names on the fly?
Jason... more >>
use an aliased column in a WHERE clause?
Posted by K. Shier at 8/14/2003 11:55:56 AM
i could swear i used to do this kind of thing in M$Access all the time:
SELECT NameLast + ', ' + NameFirst AS NameFull FROM employees WHERE NameFull
= 'Smith, Joe'
but SQL Server keeps telling me 'NameFull is an invalid column name'.
is there some bit of syntax i am missing, or is this jus... more >>
Find the list of SQL Servers Available.
Posted by Jnanesh at 8/14/2003 11:39:41 AM
How do I find the list of SQL Servers available on my network. I tried
sp_helpserver but it does not seem to show all the SQL Servers.
Thanks in advance.
... more >>
Help with Update statement on Linked server
Posted by Sasha at 8/14/2003 11:37:57 AM
I'm having trouble running this query on my server joining table tables on a
linked server.
SET XACT_ABORT ON
GO
BEGIN DISTRIBUTED TRANSACTION
UPDATE Bond
Set ItemNum = C.ItemNum
FROM Bond,CDIMS.CDIMSDemo.dbo.Charge C
WHERE BondRecId = (SELECT B.BondRecId
FROM CDIMS.CDIMSDemo.dbo.Bond B... more >>
Tables description fields are not being copy by SQLDMO objects by default.
Posted by Joe M at 8/14/2003 11:35:49 AM
By default SQLDMO does not copy tables description.
Does this work: object.Script( 4, 4194304)
is this the right syntax for OR logical
operator to copy tables with extended properties description??
What is the correct way to use the OR operator... more >>
inserting rows....
Posted by Jim at 8/14/2003 11:35:03 AM
I have a table that has a column which is a primary key and has a identity
defined on it( increment = 1)...
When a row is inserted into the table the column is automatically assgined a
value, how can i found out the value of the row that has just been inserted?
I would like to do the insert an... more >>
Analysis
Posted by Shamim at 8/14/2003 11:28:39 AM
SQL 2K
I created my cube, process data and played with it.
My question is , how to make this accessible to my users?? will they have to
get into Analysis Manager ??
Is there any automated job to refresh (process) my cube on a daily basis. ??
Thanks
Sh
... more >>
Data type question
Posted by Hawk at 8/14/2003 11:02:59 AM
Hi, All,
I have a column called Mins and type is float. I run the
query and get the summary of Mins. But problem is the
results like 401118.70000000001 or 298919.98999999999. How
can I only get 401118.70 or 298920.00? If I can use
convert(varchar(15),sum(mins)), will lose something? or I
... more >>
A cursor can't be closed
Posted by Shane at 8/14/2003 10:51:32 AM
Hi,
I am working on a stored procedure and it requires cursor
to be used in the procedure. For some reasons, I can't
close the cursor even using both CLOSE and DEALLOCATE at
the end of the procedure. Anyone has any idea what might
be the cause. The procedure needs to update the data in a ... more >>
Retrieving Coulmns in an Index from System Tables
Posted by Allen Shannon at 8/14/2003 10:34:08 AM
Hello Everyone!
I am trying to programmatically derive the columns from
syscolumns that constitute any existing index (as defined
as existence in the sysindexes system table).
Documenation states that the sysindexes.keys column is
the "list of the column IDs of the columns that make up
... more >>
CREATE TRIGGER syntax
Posted by Ted at 8/14/2003 10:32:56 AM
What is the difference between FOR and AFTER in the CREATE TRIGGER SYNTAX?
CREATE TRIGGER trigger_name
ON { table | view }
[ WITH ENCRYPTION ]
{
{ { FOR | AFTER | INSTEAD OF } { [ INSERT ] [ , ] [ UPDATE ] }
[ WITH APPEND ]
[ NOT FOR REPLICATION ]
AS
[ ... more >>
how to optimize this simple query/proc
Posted by Mark Kamoski at 8/14/2003 10:00:12 AM
Hi Everyone--
Please help.
Do you have any idea how to optimize (AKA speed up) this query?
select distinct line_type, line_item, uom_cd
from order_mgmt.dbo.job_sheet_other
where line_type != ''
and
line_item != ''
and
uom_cd != ''
order by line_type, line_item, uom_cd asc
... more >>
Foreign key constraint against primary keys in two different table.
Posted by foolmelon NO[at]SPAM hotmail.com at 8/14/2003 9:25:12 AM
Say I have 3 tables A, B, C. Table A has primary key identity column
A_primary_key. Table B has primary key identity column B_primary_key.
C table has two columns: a foreign key column primary_key_from_A_or_B,
and a bool column is_A. How can I write a constraint that in table C:
1. if is_A ... more >>
Help with Recursive SPROC (please!)
Posted by Dan Caron at 8/14/2003 9:02:54 AM
Hello,
I am having problem writing a recursive stored procedure for a Content
Management System and am hoping that someone can give me a hand with it. I
have posted (below) a script to recreate a table and data to test it with,
and I've included my sample stored procedure that isn't working as... more >>
How can I use case statement in my case, if I can??
Posted by Ricky at 8/14/2003 8:52:59 AM
Table structures are:
Table1
Key,Name,Description,Units.....
1,'A','X1Y1Z1',....
2,'B','X2Y2Z2',....
3,'C','X3Y3Z3',....
4,'D',X4Y4Z4',...
etc...
Table2
Key,Datetime,Value
1,'2003-08-01 00:00:00',23.23
1,'2003-08-02 00:00:00',-3.0
1,'2003-08-03 00:00:00;,-4.34
......
2,'2003-08-0... more >>
SQL Query !!!
Posted by Edmundo J. Davila at 8/14/2003 8:45:58 AM
Hello,
I need to create a sql statement that shows the value of a
varchar field that has 3 string and 6 number XX-999999,
and shows a special character when lose the consecutive,
for example:
P10-00001
P10-00002
P10-00003
**P10-00005
P10-00006
P10-00007
**P10-00009
**P10-00011
P1... more >>
Results to text files?
Posted by Ronald S. Cook at 8/14/2003 8:44:39 AM
Hi,
I need to write a proc that will contain several select statements. I need
each select statement to output its results to a pre-named text file.
Any suggestions?
Thanks,
Ron
... more >>
Quick Question on Indexing
Posted by Samuel Perkins at 8/14/2003 7:24:48 AM
Can you have more than one clustered index on a table? If
so how can I set it up?... more >>
SQLDMO + .NET
Posted by Mike at 8/14/2003 6:41:55 AM
Does anyone know if and when a .NET SQLDMO dll will be
available?... more >>
XML Encoding
Posted by rc at 8/14/2003 5:44:51 AM
Just hit a snag with XML parsing. Here it goes, in order
to be able to pass special characters (&, <, >, " ) in a
XML document which I pass as NTEXT variable in a stored
procedure, I need to code them. This part is not so bad,
I can do a replace with the appropriate code before
creating ... more >>
Transfer Data from one table to another
Posted by MyaTiX at 8/14/2003 1:18:29 AM
Hi,
I am trying to transfer some data from an old database to
a new one however the table structure in the new database
isn't exactly the same.
I was wondering how I do this!
I would also like to keep the same identity in the
identity column of the old Database and transfer it into ... more >>
|