all groups > sql server programming > july 2005 > threads for tuesday july 12
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
script to create ODBC DSN with specific port to server
Posted by David Shorthouse at 7/12/2005 11:49:20 PM
Hello folks,
I'm using a port other than 1433 for my SQL Server 2000 database and am
trying to write a vbscript to automate client's ODBC DSN creation. Is it
possible to specify the port used in such a script? I have "Database",
"Descriptions", "Driver", and "Server" additions to the cl... more >>
dts a lot of data between 2 tables
Posted by Hassan at 7/12/2005 9:50:44 PM
Id like to dts a lot of data( around 100GB) from one table to another.. How
can I do so without blowing the Tlog ? Basically I guess I need to commit
more frequently and dont know how to do so
Or maybe I could use an insert select statement to do this instead of DTS
But how can I commit afte... more >>
Writing to the Event Log
Posted by Dave Elliott at 7/12/2005 7:31:42 PM
I am trying to track down a problem of calling a stored proc from some
..NET code.
I would ultimately like to be able to examine the log files to see
what SQL Server is trying to run. I see from several other postings
that examining the log file is not feasible.
Since I am doing just devel... more >>
BCP Host files must contain one column?
Posted by S at 7/12/2005 4:55:01 PM
I am bcp'ing a table and I am getting this error when the bcp actually
finished its task. Its doing the task and spitting out this error to the
client? How can I resolve this?
Here is my bcp stmt
DECLARE @bcp varchar (2000)
DECLARE @result int
SELECT @bcp = 'bcp "select t2.* into db... more >>
SP Problem
Posted by RC at 7/12/2005 4:46:02 PM
I have a SP which I have had running for several weeks now. It run in ~20
seconds every time, until last night. Last night the job that runs the SP
started, but did not complete after over 7 hours. I killed the job at that
time.
There was no blocking, nothing looked out of the ordinary... more >>
Compatibilty Level
Posted by Tony Schlak at 7/12/2005 3:52:35 PM
I have a view that works when the compatibilty level is 65 and not when 80
is selected. Here is the view:
... more >>
how to select from subquery?
Posted by Rich at 7/12/2005 3:38:08 PM
Select col1 From (Select * From tbl1 Where somecondition = 1)
I am getting a syntax error when I try a query as above. I could swear I
have done this before. Could someone point out what is incorrect above?
Assume col1 exists in tbl1.
Thanks,
Rich... more >>
QA login a pain
Posted by Paul at 7/12/2005 2:15:57 PM
I updated my SS2K password to something longer and nastier. I'm getting
tired of typing it every time I bring up a fresh instance of QA. Is there a
way I can get QA to log in automatically from a password I supply once, like
in EM? Anything involving storing the password in plaintext is not an
o... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Long Running Stored Procedures.
Posted by Al K at 7/12/2005 1:49:07 PM
I have a stored procedure, which in turn will call three child stored
procedure. It runs exactly correct, and produces the exact results desired
when called from Query Analyzer, and takes about 1.5 seconds to run.
The exact same query, with the exact same parameters, will execute from some ... more >>
indexes - confusion
Posted by Luis Cordell at 7/12/2005 1:35:06 PM
I understand the "create unique" option when creating a new index. I don´t
understand the diference between the two next options "constraint" or
"index".
Does a "create unique" with "constraint" works like a index for accelarate
queries ?
And the difference between index with "ignore ... more >>
Blocking Issue
Posted by fbwhite NO[at]SPAM online.nospam at 7/12/2005 1:15:03 PM
We are currently experiencing a blocking issue on one of our SQL Servers.
The majority of the time, our database is running fine and our stored
procedures return in less than 4 seconds. For the last 4 weeks, once a week,
locks begin to occur and they are endless. The locks are not deadlocks... more >>
Update adjoining table
Posted by Sandy at 7/12/2005 12:49:03 PM
Hello -
I am having a brain glitch. Picture this - three tables: tblMain, tblType,
tblMainType (tblMainType is the ajoining table).
I just inserted 376 records into tblMain. tblMain has MainID as the primary
key.
I now have to insert 376 entries into tblMainType. tblMainType consists... more >>
Self Updating a Table
Posted by Brian Piotrowski at 7/12/2005 12:38:42 PM
I have a statement that I need to dynamically update each of the rows in a
table. However, some of the data also comes from the same table, and I need
this info to select the rows to update.
Here is the static statement:
update dmdpg_pf set (shortqty, skdlym, skdlrrn) =
(SELECT (dmdpg_pf... more >>
Best Way to Run Large Query?
Posted by Ooroster at 7/12/2005 12:34:59 PM
Hi all,
I support an application that the users have requested I manipulate 1
field for better sorting. The vendor is having a hard time sending us a
patch to correct the problem at the frontend. So I've been asked to run
a script to change the data into a different date format(from mm/dd/... more >>
Query Question
Posted by JJoshi at 7/12/2005 12:30:02 PM
I am not a programmer but need to a write a store proc to make something work.
I have a query that needs to refresh the table based on the following
busines rules:
1. If the RunDate is between 1 and 14 then exclude the current month and
update only 3 months before the current month (total... more >>
Downgrading sql server 2005
Posted by John at 7/12/2005 12:23:56 PM
Hi
Would any .net application developed for sql server 20005 server edition
work on sql server 2005 express edition? This is in case the target client
does not have a license of sql server 2005 server edition.
Thanks
Regards
... more >>
Stored procedures or not
Posted by John at 7/12/2005 12:23:32 PM
Hi
In the context ox a vb2005/sql server 2005 app, how useful is it to use
stored procedures?
Thanks
Regards
... more >>
2 INTERGER FIELDS TO GET FLOAT RESULT
Posted by Souris at 7/12/2005 12:19:02 PM
I wanted to divide 2 integer fields to get percentage result like the
following.
MYFIELD1 INTEGER
MyFIELD2 INTEGER
"SELECT CAST(MYFIELD1 AS FLAOT)/CAST(MYFIELD2 AS FLOAT) AS MYRATE FROM
MYTABLE"
I got float result, but I would like it presents as "95.00%" or :19.12%"
Are there any w... more >>
Newbie: Delete common entries between tables
Posted by steve at 7/12/2005 12:17:36 PM
Hi,
like the title says I want to delete the common entries between two tables.
When I use:
SELECT * FROM tblA
WHERE EXISTS
(
SELECT *
FROM tblA, tblB
WHERE
tblA.Name = tblB.Name
AND
tblA.ID = tblB.ID
)
I get the common entries, However when i replace SELECT with DELETE, it
del... more >>
about cursors
Posted by afollo at 7/12/2005 12:08:23 PM
I am trying to write a nested cursor that will tell me first which columns
in the database have 'smallint' as a datatype (this work so far)...than I
have to print a list of the records in the database (related to the found
columns) which contain values that are not between 0 AND -1...I don't
nec... more >>
T-SQL and ntext
Posted by Pierson C at 7/12/2005 12:01:02 PM
All,
I am writing a stored procedure that dynamically creates sql to execute.
The WHERE clause of the sql is pulled from a column that is of type ntext,
the SELECT/FROM is static.
My issue is with concatination of the local variables of 'char' type and the
'ntext' data held in the column(... more >>
Getting 2 SUMs from the same table
Posted by Astra at 7/12/2005 11:44:21 AM
Hi All
I'm really stuck on this one so would appreciate any help you can give.
In essence, I have 1 SQL 2000 table with rows of data logging stock
movement. To differenciate between a stock sale and a stock receipt the
table has a TRANSACTIONTYPE field so that 8,7 equal invoices and 3 equ... more >>
date part information
Posted by Souris at 7/12/2005 11:16:03 AM
Can I get date part informaiton from datetime datataype?
I just wanted the date part like "07/11/2005" from a datetime data type.
I wanted to user datepart, but it only gets a part of date time like date,
month, or year.
I tried to use CONVERT, but it is no more date type. It is a string ty... more >>
Table creation and filegroups - When T_SQL behaves badly...
Posted by Joel at 7/12/2005 11:10:03 AM
....or perhaps rather the programmer....?
I am experimenting with how to create a table, with the table on one
filegroup, and the primary key index on another. When I enter the following
into Query Analyzer:
USE MyDatabase
GO
CREATE TABLE MyDatabase.dbo.t_Bands
( Band_Id int IDENTITY(... more >>
Getting Database Status
Posted by Kael_Sidhe NO[at]SPAM yahoo.com at 7/12/2005 10:36:16 AM
I found a few posts on this subject but no answers. I am an Oracle DBA
who has been tasked with writing a script to obtain the
status/availability for all SQL Server databases during our DR test.
Needless to say I don't know what I'm doing.
If this were Oracle I'd simply query file status fro... more >>
ODBC Timeout
Posted by Pancho at 7/12/2005 10:35:02 AM
Hello, I have an application that provides a monitor of active help desk
calls. It uses a constant ODBC connection. The user does nothing--sends no
data to the database. Intermittently this display fails with a yellow
triangle and an exclamation point, and no further information. Restartin... more >>
Foreign Key to a Computed Column
Posted by Dima at 7/12/2005 10:23:02 AM
Hello,
Is there a way to get a column in Table2 to be have a foreign key constraint
referencing a primary key computed column in Table1?
I get an error (1784) when trying to create Table2, telling me that the
foreign key cannot be created because the referenced column is a computed
colum... more >>
Table locked
Posted by Denis at 7/12/2005 10:19:57 AM
I'm try to open a table from Enterprise Manager on SQL server but it seems
to be locked by someone
I think the problem was caused by a bad ASP script. How can unlock the
table? Do I have to reset IIS where the script was running or is there any
other better solution?
Thanks
... more >>
Query Active Directory
Posted by Ed_p at 7/12/2005 9:58:47 AM
Hello,
I am looking for a way to query for the members of a group from our
Active Directory. I have looked around on the web and have seen that
one way to do this is to create a linked server. I was wondering if
there was another way to do this without creating a linked server.
Also, d... more >>
Time-outs, i have to reset the sql server to generate again info?
Posted by Alex at 7/12/2005 9:27:17 AM
Just after starting the server every thing is OK, but After one day of normal
work I can not generate a report, i get a time-out, all i have to do is to
stop sql server and start it again, in order to being able to generate the
report and so on.
this happens only with the most demanding repor... more >>
case statement in where clause
Posted by Souris at 7/12/2005 9:20:03 AM
I wanted to update my table depends on the week doy of today.
For exampl:
"UPDATE MYTABLE
SET MYVALUE = 1
WHERE CASE WHEN DATEPART(WD, GETDATE()) = 1 THEN
DATEDIFF(DAY,MYTABLE.MYDATE, GETDATE()) = 3 ELSE
DATESIFF(DAY,MYTABLE.MYDATE, GETDATE()) = 1 END"
I wanted to update last work... more >>
help with join
Posted by Joe Gass at 7/12/2005 9:09:40 AM
Products database
CREATE TABLE [dbo].[Products] (
[ProductID] [bigint] IDENTITY (1, 1) NOT NULL ,
[CategoryID] [bigint] NULL ,
[ProductTitle] [varchar] (200) COLLATE SQL_Latin1_General_CP1_CI_AS NULL
) ON [PRIMARY]
GO
CREATE TABLE [dbo].[Categories] (
[CategoryID] [bigint] IDENTITY... more >>
This can't be true, is it?
Posted by Zorpiedoman at 7/12/2005 8:55:02 AM
I have two tables. Both have an insert trigger. Table A inserts a row into
Table B via the trigger. Table B's insert trigger has a line:
Insert Into A (x,y,z) values (1,2,3) Where 1=2
Now, this statement should not be inserting any rows into table A, right?
However, attempting to add a... more >>
Grouping by date
Posted by mark at 7/12/2005 8:51:23 AM
Hi
I have a table that contains order details (DDL at bottom).
I want to be able to sum the quantity and group by a user specified
time period (e.g. weeks, months). This is straight forward when using
weeks or months, because I can do something like:
SELECT ProductCode, SUM(Quantity)... more >>
Performance Read
Posted by Ed at 7/12/2005 8:50:06 AM
Hi,
When I look at the Server Trace in QA, I run two different queries but one
with WHERE clause and one doesn't
e.g. Select a.* from customers a inner join orders b on a.customerid =
b.customerid
The Server Trace shows
Duration CPU Reads Writes
15 16 51
... more >>
Running Scripts foreign key problem
Posted by thomson at 7/12/2005 8:43:05 AM
Hi all,
i do have a production database as well as a test database.
the production database goes on frequent modifications, at the end of
the day, i do have to make the changes in the test database.
I generated a script of all the objects and tried to execute in the
test database, but... more >>
Transactions and Table Locking
Posted by Frankie at 7/12/2005 8:09:42 AM
Just trying to understand transactions and how they relate to locking:
Suppose I have a db with 5 tables.
Then I have an application that makes use of ADO.NET to interact with this
db. The application starts a transaction then proceeds to insert or update
rows in each of the 5 tables; first ... more >>
DTS Query
Posted by jsfromynr at 7/12/2005 7:51:13 AM
Hi All,
Im trying to create an hyperlink inside a result column from an sql
query
inside an excel worksheet.
If I type the text manually into a cell, as in (example)
=HYPERLINK("#Sheet1!A1", "Value")
it works fine, that is, it shows as "View" underlined, just like a
hyperlink, and whe... more >>
detecting errors in nested transactions
Posted by alfred at 7/12/2005 7:41:02 AM
Hi
I would like to know if there is a way in T-SQL to detect an error in a
stored procedure that calls another stored procedure. I would like to catch
any error in the inner sp on the outer sp. like this
exec sp_inner
if @@error <> 0
'do something
this does not work, because when ... more >>
storing dates and table design
Posted by Kurt Schroeder at 7/12/2005 7:28:02 AM
Some one posted a link to an artical covering best prectices for working with
calendars, and storing dates. I have always stored dates as integers using
YYYYMMDD format, but am open for alternatives, esp if they are better
options. If you know of the link or have any ideas please let me know
... more >>
Invalid Object Name
Posted by Glynne at 7/12/2005 6:46:11 AM
Anyone ever seen this one.
I have a stored proc that uses SELECT… INTO against a linked server to
create a couple of temporary tables, then a little further down it does a
SELECT against those temp tables.
First thing in the morning I have a BCP that uses QUERYOUT to execute that
stor... more >>
mismatch error when bulk inserting
Posted by gja at 7/12/2005 5:20:56 AM
Hi Folks,
I'm working on a WIN XP SP2 station with SQL2K SPMax (3 or 5 ?)
I'm bulk inserting right thousand of lines in my db but the third one
below generate error 4864. That's the 2003-29-12 value that seems to be
in charge for this problem.
MAG|FR|68|0000000Q80977|1|2005-28-6|2005|6|20... more >>
implementing a nested query as join
Posted by GetGoing at 7/12/2005 3:28:02 AM
Hi,
we have the following two tables in the pubs database of SQL Server
authors --contains the list of all authors, with each author having a
unique au_id
titles ----contains the list of all titles, with each title having a
unique title_id
titleauthor ---a relationship table contain... more >>
quotes, why?
Posted by Enric at 7/12/2005 2:01:02 AM
Dear all,
I've got a dinamic statement which is failing due to ' character and I don't
know why. What's happening?
declare @cont2 integer
declare @sql varchar(303)
declare @operacion char(14)
declare @veces integer
set @cont2 = 1
set @operacion = 'Actualizacion'
set @veces =... more >>
Using Labels!
Posted by Arpan at 7/12/2005 1:49:37 AM
Consider the following code:
-------------------------
IF(SELECT SYSTEM_USER)='SQLServerUserName'
BEGIN
GOTO lblTrue
SELECT 'True'
END
ELSE
BEGIN
GOTO lblFalse
SELECT 'False'
END
lblTrue:
PRINT 'Skipped the SELECT statement under IF'
lblFalse:
PRINT 'Skipped the SELECT state... more >>
Tricky issue with a EXEC
Posted by Enric at 7/12/2005 12:36:01 AM
Dear all,
I perfectly know that this issue is very strange. I've got a stored
procedure which launch a dinamic set of intructions through EXEC statement
inside a loop.
I enclose you the following snippet:
declare @cont integer
declare @cont2 integer
declare @cont3 integer
declare @sq... more >>
PK???
Posted by ReTF at 7/12/2005 12:00:00 AM
Hi,
Can anyone explaim to me if a Primary key is a Index?
I did try crate this index in this table:
CREATE UNIQUE CLUSTERED INDEX
UFIdex ON UF(Rotulo)
WITH DROP_EXISTING
CREATE TABLE UF
(
UF char(2)
NOT NULL,
Rotulo varchar(25)
NOT NULL,
Constraint PK_UF
... more >>
Immedeite Help Required! - Fulltext indexing
Posted by Sathian at 7/12/2005 12:00:00 AM
Hello All,
When I restore a backup on a different Server, It automatically creartes the
records in sysfulltextcatalogs which refers the Catelogue path of old
database.
How to come out of this Proble?
If I remove the records from sysfulltextcatalogs, then while enabling the
Database for Ful... more >>
Identify inserted rows
Posted by Axel Dahmen at 7/12/2005 12:00:00 AM
Hi,
I'd like to insert several rows into a table in a multi-user environment and
afterwards uniquely identify the new rows without having unique keys defined
in the table (except "ID INT IDENTITY PRIMARY KEY").
I know this is not possible in SQL Server 2000. Does anybody know if SQL
Server ... more >>
Date Functions - datepart parameter
Posted by Simon Woods at 7/12/2005 12:00:00 AM
Hi
Our app runs on both Access and SQL server. We've a DB layer to manage the
differences. I've hit a problem with the SQL Server Date functions,
DatePart/DateAdd/DateDiff etc in that the datepart parameter needs to be
'not single quoted' (or depending on DB settings unquoted). I don't know SQ... more >>
I WANT to make a view
Posted by Bpk. Adi Wira Kusuma at 7/12/2005 12:00:00 AM
I WANT to make a view that import from FoxPro. Can I do?
... more >>
SQL Query HELP
Posted by walterd at 7/12/2005 12:00:00 AM
Hi
Can some shed some light on this query?
I have a table with the following data:
Table A
ID DATE VALUE
===================================
1 12/07/2005 10:05:22 15
2 12/07/2005 11:00:02
3 ... more >>
How to make a 1-many relationship???
Posted by Arthur Dent at 7/12/2005 12:00:00 AM
I keep trying to set up a 1-many relationship between two tables, but the
database keeps insisting on making it 1-1.
How can i force this relationship to go in as 1-many?
The 1 table will always have a record, but the many table may or may not
have a record.
the one table has a PK of ID
th... more >>
Do U have idea?
Posted by Bpk. Adi Wira Kusuma at 7/12/2005 12:00:00 AM
I want to create a view like Crosstab Query at ms. Access. Can I do it?
at ms. Access, I ever made query like this:
TRANSFORM First([Query1].[FCTIME]) AS FirstOfFCTIME
SELECT [Query1].[FCIDNUMBER], [Query1].[FDDATE]
FROM Query1
GROUP BY [Query1].[FCIDNUMBER], [Query1].[FDDATE]
PIVOT [Query... more >>
|