all groups > sql server programming > august 2004 > threads for friday august 13
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
Resettin Running Total
Posted by Scorcel at 8/13/2004 11:19:01 PM
Hello I need Help on this.
My Table Structure is below:
CREATE TABLE [dbo].[CDMS_tbl_Palletizer_Pallets] (
[txtPackRepNo] [varchar] (15) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[intPalletNo] [int] NULL ,
[intQuantity] [int] NULL ,
[dateStart] [datetime] NULL ,
[dateEnd] [datetime] ... more >>
Copy Table Structure to Same Database
Posted by clintonG at 8/13/2004 9:48:32 PM
I have created a table with many columns that needs to be duplicated
within the same database where the duplicate table can then be modified.
The context menu in the Enterprise Manager enables a copy selection
but then there is no paste. Using Query Analyzer I tried the following...
SELECT *... more >>
UDF and Default parameters
Posted by RG at 8/13/2004 9:25:15 PM
Hi,
The requirement is adding a where clause to the select
statement based on where the input parameter was sent a
value or not. Can this be done using UDF's?
for eg: If the RegionParameterID in the following
function is passed as null, I dont want the where clause
in the select stateme... more >>
Need help with this sql statement
Posted by Fie Fie Niles at 8/13/2004 3:54:29 PM
I have 2 tables: employee table and Supervisor table.
Employee table has 2 columns:
-emp_id (Primary key)
-emp_name
Supervisor table has 2 columns:
-emp_id (Foreign key to table Employee)
-supervisor_id
For example:
Employee Table data:
emp_id emp_name
1 aaa
2 ... more >>
UDF and SQL2000 - Why doesn't this work?
Posted by Calvin X at 8/13/2004 3:38:34 PM
Hi Everyone,
I am having some problems getting this user defined function to return data
that I need. Basically This is what I want to do - I have created a query
that breaks down values for a period start and end into a daily value and I
want to loop through these values and sum the total valu... more >>
OPENROWSET not working with variables
Posted by Ian at 8/13/2004 3:22:38 PM
Hi
How is it that this works fine
INSERT INTO #tblNewData
SELECT InstructionID, PlainText, PlainText2
FROM OPENROWSET ('Microsoft.Jet.OLEDB.4.0', 'Excel
5.0;Database=C:\MyTestFile.xls;HDR=YES;IMEX=1',ImportData1)
But This comes up with an error
Line 235: Incorrect syntax near '... more >>
LocalTime Conversion
Posted by Bruce Rose at 8/13/2004 3:02:22 PM
Does anyone know how to take an existing SQL datetime value stored as
localtime (EST) and convert it to UTC or GMT? Is there a an existing
function. I am running SQL 2000. i.e. The date returned from my SQL
table is 04/02/2004 00:00:00 as EST. I believe this would be 04/02/2004
05:00:00 as ... more >>
Output parameter question (again - hehe)
Posted by Rob Meade at 8/13/2004 2:07:25 PM
Hi all,
Regarding the output parameters that I started a thread about yesterday - I
have another question.
Whilst we covered using them from the perspective of access the outputted
value in another stored procedure, I have now realised that in my parent SP
which calls all of the others I ne... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Alter Procedure
Posted by L Gonzales at 8/13/2004 1:31:10 PM
Is there a way to track or view the date stored procedure
was last altered?
TIA... more >>
No UDTs in user defined functions?
Posted by Jens Weiermann at 8/13/2004 1:23:48 PM
Hi,
I'm about to write a user defined function that returns a table. In this
table, I'd like to use a user defined type, but I'll get an errorcode
telling me something about not being able to find that type (sorry, using
German version, so I don't have the exact wording in English).
Am I... more >>
Limit selection to row x to row y ?
Posted by Lisa Pearlson at 8/13/2004 1:21:16 PM
Hi,
An old, common problem I think..
I do SELECT * FROM myTable en get 100 records.
I wish to display record 5 to 35.
I remember a discussion a few years ago, where Oracle had such a feature
(LIMIT ?) while SQL Server did not, because relational databases are about
sets and so "record ... more >>
overflow
Posted by jack at 8/13/2004 12:55:01 PM
In ACCESS when I run a query with a criteria (of values less than a number),
after the query runs and depicts the results, it gives me the following
overlow message box. Once I click on OK in this message box, all values of
the table turn to "#Name?". Could you please suggest to me what I... more >>
Email trigger not working - please help
Posted by vtipi NO[at]SPAM msn.com at 8/13/2004 12:28:13 PM
Hello,
Can someone look at this trigger and let me know what I am doing
wrong.
The trigger is supposed to send out an email when a new record is
inserted into the table(tblHealth)
CREATE TRIGGER health
ON tblHealth
FOR INSERT
AS
DECLARE @hName nvarchar,@DateOfBirth smalldatetime,@Height
... more >>
Update Statement Issue??
Posted by anonymous NO[at]SPAM discussions.microsoft.com at 8/13/2004 12:25:21 PM
Hi,
I am having a problem with my update statement for my
DataMart. (Using example here).
I get text file & load it into TableA in Staging. From
TableA I load it into Dimension TableB as is. Therefore
now I have
TableA
CustomerID Name City Category
---------- ---- ... more >>
Stored procedure - parameter in IN clause
Posted by Mindy Zhang at 8/13/2004 11:41:14 AM
Hi,
I created a stored procedure with three parameters in SQL server 2000. Data
types are datatime, integer and char. The last parameter value looks like
'1234AB', '1234TG', '7890IK'. I got a problem when I tried to EXECUTE the
stored procedure because of the commas in the last parameter. ... more >>
Covering index causes blocking on exclusive latch acquisition in tempdb?
Posted by Kevin Stark at 8/13/2004 11:37:19 AM
Yes, this problem is as bizarre as the subject line. Let's see if I can
explain it.
System: SQL 7.0 Enterprise Edition SP4. Windows 2000 Advanced Server.
Running in shared disk cluster.
We have around two dozen databases with the same schema. There are two
tables in question: multi_val_attr... more >>
can non dbo execute alter in stored proc
Posted by dk at 8/13/2004 11:28:24 AM
is there a way to have an alter statement run
inside a stored procedure which a non
db owner executes?
tia,
dk
... more >>
Is rowversion guaranteed to be monotonic?
Posted by howard NO[at]SPAM nospam.nospam at 8/13/2004 11:17:02 AM
Before posting, I noticed that a question titled “Is rowversion guarenteed to
be sequential?†was posted just 4 days ago. The poster expressed my exact
concern, but I notice that no one from MS or elsewhere gave a definitive
answer. I would appreciate a definitive answer that would clear u... more >>
how to get 1st rec from group?
Posted by Li at 8/13/2004 11:02:27 AM
I have a need to get just the 1st record from a group
of records. How can I do so?
I have a table with key as EmpCode + Year + Month
it has data like '123'+2004+01+ other details ....
'123'+2004+02+ other details ....
'456'+2004+01+ other details ....
... more >>
Sum of a column obtained from select query
Posted by zeyneddine at 8/13/2004 10:47:03 AM
how to do this?
If the following is obtained as a result of a query, how to obtain the total
sum of column2 in the same query?
column1 column2 column3
A 1500 ABC
B 3000 ACD
C 1500 DEG... more >>
User Defined Function Syntax Question?
Posted by Calvin X at 8/13/2004 10:44:33 AM
Why does the following line give me a sytax error new 'SELECT' when used in
a user defined function:
SET @DailyVal = SELECT DailyVal FROM qryUtVariablesDailyVal WHERE
VarCode=@Var AND StartDate < @CurDate AND EndDate >= @CurDate
Thanks
Calvin X
... more >>
interesting problem
Posted by Lisa Pearlson at 8/13/2004 9:24:46 AM
SQL7:
Let's say I have a record that has the following 2 rows:
N
1
7
I want to create a VIEW that shows these two and all values in between:
N
1
2
3
4
5
6
7
Or, yet another related problem:
a VIEW that shows the numbers 1 - 100.
I guess this is not possible because. It would ... more >>
Code ...
Posted by Asok at 8/13/2004 9:07:35 AM
For the below posted code, I am getting error -
"Syntax error converting the varchar value ' 210-21' to a
column of data type int."
How to resolve this error for the following code -
*** code starts here ****
DECLARE tables_cursor CURSOR
FOR
SELECT file_num FROM Editfile group b... more >>
Recursive problem
Posted by Han at 8/13/2004 9:07:01 AM
Hi !
I' ve a tree (like a table) like this:
ColumnFather ColumnChild
A B
A C
B D
B E
A
/ \
B C
/ \
D E
How obtain (recursivily... more >>
how can I avoid NOT IN
Posted by ChrisR at 8/13/2004 8:59:52 AM
sql2k sp3
Its my understanding that NOT IN should be avoided. But I
cant figure out how to not use it in this scenario. I need
to select the sum of values for a particular group of
trancodes(groupB) from a sum of values from another group
of trancodes(groupA). The problems is, I dont know... more >>
querying for lower case
Posted by erinl at 8/13/2004 8:48:55 AM
I am trying to find specific entries in my database that
are in entered in lower case. I am running the query in
enterprise manager. Specifically I am trying to find
where the field country = 'us' -- not 'US'?? ... more >>
Solution to: How To Pad in MSSQL?
Posted by JDP NO[at]SPAM Work at 8/13/2004 8:48:21 AM
The opposite of trimming spaces is to pad them into an expression. To pad in x
number of trailing or leading spaces with the various vendors:
Microsoft SQL Server
Not supportedMySQL SELECT LPAD('sql_in_a_nutshell', 20, ' '),
RPAD('sql_in_a_nutshell', 20, ' ');Oracle
SELECT LPAD(('s... more >>
SQL triggers - exporting data
Posted by JoeDz at 8/13/2004 8:43:02 AM
I am new to MS SQL, have the following problem to solve.
For every insert to some table, if the new record has a severity value of 3
or higher, I have to extract several attributes of this record.
The real purpose of the trigger is to extract this data, and to transfer it
to another machin... more >>
Continue On Error using ALTER TABLE
Posted by Sam Winston at 8/13/2004 8:36:38 AM
I have a set of tables with about 200 int fields and 4
million records. I've found that most of the data values
would fit in a smallint field and save disk space.
Rather than do a lenthty analysis using MAX(Field) and
determining which ones would and which ones wont I
figured I'd brute f... more >>
DISTINCT vs. GROUP BY
Posted by Lisa Pearlson at 8/13/2004 7:52:11 AM
Hi, I want a list of unique records.
I can do:
SELECT DISTINCT name FROM tblItems
or
SELECT name FROM tblItems GROUP BY name
Which one is better? which one has better performance?
... more >>
Timeout on sql query
Posted by arun_hallan NO[at]SPAM hotmail.com at 8/13/2004 7:18:49 AM
Im querying a very big database using the following command.
Set oADORs = oEqDatabase.GetADORsFromSP_SPReadOnly(strSPName, oParams,
10)
Sometimes the querys take a very long time, and im wondering how id go
about implementing a timeout after say 5s... more >>
Stored Proc results vs. Query Analyzer
Posted by Janet at 8/13/2004 7:09:07 AM
I've got a stored proc that isn't giving the results it
should and I'm flumoxed. I took the stored proc and
copy/pasted it into query anlayzer (commenting out only
the naming, etc. and assigning the passed variables with
set). I created a view with the criteria. Both give the
desired resul... more >>
I need a bug fix for KB 290817 - anyone know how/where to get?
Posted by Tom Werz at 8/13/2004 6:58:27 AM
I don't want to pay $99 to get the fix... does anyone
know how to get it for free? The bug is related to
aggregate functions in subqueries (and I can't use the
suggested "top 1" workaround for what I need to do).
I tried going through free support but it asks for the
ProductID for SQL 2... more >>
index selection ?
Posted by Lisa Pearlson at 8/13/2004 6:36:12 AM
Hi, can I number my selection?
I know I can do something like
SELECT IDENTITY(INT,1,1), MyRecords
But that requires an INTO table.
I am on SQL7, so no UDFs allowed.
Is there some kind of construction using SUM or COUNT to get this?
In other words, imagine I have a table with 1 column... more >>
One column is nullable on the composite key
Posted by net__space NO[at]SPAM hotmail.com at 8/13/2004 6:32:06 AM
Hi All!
I would like to have a composite PK on 3 columns, one of them is null
CREATE TABLE TableA (
ColA int NOT NULL ,
ColB int NOT NULL ,
ColC char (3) NULL ,
......
)
GO
ALTER TABLE TableA ADD
CONSTRAINT TableA_PK PRIMARY KEY CLUSTERED
(
ColA,
ColB,
ColC
... more >>
difference between dbo.table and just table ?
Posted by Lisa Pearlson at 8/13/2004 6:16:34 AM
Hi,
I can do SELECT * FROM dbo.table or just SELECT * FROM table
I can also do SELECT * FROM myDatabase.dbo.table
The advantage with the latter is that it can be called from any current
database and it will always work on myDatabase, but what's the point of the
first form, with just dbo a... more >>
Update between 2 tables ?
Posted by Stefan G. at 8/13/2004 4:33:02 AM
Hi,
I have 2 tables and i would like copy data from the first table to the
another table. Can i use "update" for this ?
Example but don´t work:
UPDATE tbl1, tbl2
SET tbl1.field1 = tbl2.field1
WHERE tbl1.field2 = tbl2.field2
thx for help... more >>
DTS - Skip Tasks Help
Posted by Sekar at 8/13/2004 3:13:02 AM
I need to skip some of the tasks in a DTS package based on failure condition
of a specific task. For example as shown below if the task3 fails it will go
to Task8 from there I need to call task6.. So that I can skip the task4 and
task5.
Iam using MSSQL 7.0
Any help is highly appreciated.
... more >>
Insert FK
Posted by jez123456 at 8/13/2004 3:09:03 AM
I have a table (tblEmployee) with PK strLogonName.
I also have a table (tblEntitlement) with FK strLogonName.
How do I keep these tables synchronised. i.e if I enter a new record in
tblEmployee I also want the strLogonName to automatically enter in
tblEntitlement.
Do the relationships d... more >>
Moving mount points
Posted by tram_e NO[at]SPAM hotmail.com at 8/13/2004 3:04:51 AM
Can we unmount primary server data and log file volumes and mount it
to secondary server? We have special requirement where we need to do
this in case of primary crash.... more >>
very nasty problem .. please help
Posted by Lisa Pearlson at 8/13/2004 2:08:37 AM
Hi,
I believe this is a bug in SQL7, it works fine in SQL2000.
The problem is I think that SQL7 does not optimize well or has a bug with
memory management and causes and sqlDumpExceptionHandler with
EXCEPTION_ACCESS_VIOLATION because it seems to be related to the amount of
data returned (17... more >>
Trigger question
Posted by Peter at 8/13/2004 2:03:02 AM
Hello!
I am trying to create a trigger which updates one column with particular
info if another column in the same table has beed modified. In addition I
have to check somehow if column has been modified to particular data only
then trigger is executed. For example if status is changed to "... more >>
Resultset to vb
Posted by Chris Thompson at 8/13/2004 1:52:20 AM
I'm having problems with the stored procedure below because i'm not able
to get the resultset or return the result of this procedure through or
to vb (visual basic 6.0) and need help as to how to go about it.
Thanks in advance
CREATE PROCEDURE sp_InterestByCertificateNo
@Certif... more >>
|