all groups > sql server programming > june 2006 > threads for friday june 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
IDENTITY SELECT
Posted by Taha at 6/23/2006 10:07:04 PM
Hi All
How Can I Select From Table With IDENTITY For Row Count
The Table Has No IDENTITY Column
Select Col1,IDENTITY As Col2 From My Table
Col1 Col2
A 1
B 2
C 3
D 4
... ..
Thanks
... more >>
SQL Select
Posted by magix at 6/23/2006 9:54:20 PM
have following table record
Year ModelYr Type
1999 1994 2
1999 1999 3
2000 1999 4
2001 2000 2
1999 1996 4
2000 1996 5
2000 1998 ... more >>
HELP on SELECT Statement
Posted by magix at 6/23/2006 9:41:42 PM
I have following table record
Year ModelYr Type
1999 1994 2
1999 1999 3
2000 1999 4
2001 2000 2
1999 1996 4
2000 1996 5
2000 1998 ... more >>
time-series calculation logic question
Posted by GB at 6/23/2006 6:44:51 PM
Hello,
I have a simple table of 2 columns: datadate ( datetime) like '2006-01-31'
and x (real).
I am trying to implement the following logic:
If x(t-1) > x(t-2) then Flag(t) = 1
If x(t-1) < x(t-2) then Flag(t) = 0
If x(t-1) = x(t-2) then Flag(t) = Flag(t-1)
So, t is datadate column value ... more >>
UDF vs SP
Posted by Robert Bravery at 6/23/2006 5:32:53 PM
Hi all
Which is quicker, better for returning a recordset.
A UDF or a SP.
THanks
Robert
... more >>
Kind of cross-tab query
Posted by J055 at 6/23/2006 4:26:41 PM
Hi
I'd like to get the results below from this sort of data. I might also have
additional tables that need another 'prods' type column.
Thanks
Andrew
---------------
declare @docs table (docID int primary key, docname varchar(25))
declare @prods table (prodID int primary key, docID i... more >>
creating Powerpoint presentations (etc) from SS 2000 T-SQL
Posted by Randall Arnold at 6/23/2006 4:09:35 PM
I have a need to create Powerpoint presentations from T-SQL queries (SS
2000). Contents will involve sharts and tables. Now, I can think of some
crude hacks to accomplish this but I'm looking for the most elegant method
that doesn't require an intranet server (not a possibility at the moment... more >>
Distributed Queries
Posted by Karen at 6/23/2006 3:27:09 PM
We are using MS SQL Server 2000 service pack 4.
On our production servers the following scenerio works, our LAN
department recently rebuilt one of our development servers and we are
having problems.
On our central development server I create a temp table CREATE TABLE
#Temp(dur_code char(1) NO... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
get a count between a time range
Posted by TDT at 6/23/2006 2:12:46 PM
I am trying to figure out if I can do this in a SQL query. I need to
know how many users are active during a given time period. I want to
be able to return the results below. If you look at the row with
User3 I only want to count User2 once even though he was active twice
during the time fra... more >>
Datetime comparison problem
Posted by Ellie at 6/23/2006 1:32:16 PM
Hi,
I am having trouble finding any records with a datetime of 2006-06-16
09:04:39:347. This time clearly falls between the beginning and end times.
I'm even converting to a char to see if that works. It seems to work if I
use .346 but sometimes it requires a difference of .003. Can anyone... more >>
Why run time double in a script?
Posted by nick at 6/23/2006 1:30:02 PM
I have table value UDFs. It takes about 2.5 minutes when I execute
select * from dbo.myudf('...')
I have a stored procedure to run thousands of the UDFs as dynaml SQL:
@sql = 'insert into @tablevalue select '+.....+' from dbo.myudf('+...+'...)'
exec (@sql)
However, it takes about 4.7 minu... more >>
Searching sql image types with WHERE clause
Posted by James at 6/23/2006 11:39:07 AM
Hello,
I am storing finger print records in sql server 2000 on a table with a
column type of image. I am able to store and access the records with no
problems at all. I had a late breaking requirement to search for a
duplicate image record before I add any new ones to the table. I
quickly fou... more >>
duration vs cpu
Posted by Lianne Kwock at 6/23/2006 11:07:02 AM
Hello all,
I ran a trace on a store procedure and the result showed that the duration
is 500 ms vs 80 ms on cpu. I want to know why duration is taking a lot
longer than the cpu time. Does anyone know what might have slowed down the
process in this case?
Any input on this is highly appr... more >>
Problem using EXEC() to run DBCC DBREINDEX
Posted by nosurfdj at 6/23/2006 11:06:01 AM
I am trying to run DBCC DBREINDEX using EXEC(), code is below.
Based upon the error message at the bottom, the @currenttable variable
receives the value 1 but when @currenttable is referenece in the DBCC
statement, the value isn't there. Can anyone tell me what I'm doing wrong?
declare @sql... more >>
Does many tables matters
Posted by Steve, Putman at 6/23/2006 11:01:36 AM
Does it matter if we have hugh number of tables vs few tables.
One example is this.
We have a table called Vendors where VendorID is the Primary key, and
another table VendorNotes (VendorID Int, Note varchar(500)) where VendorID
is the foreign key. This is one to one relation, and all vend... more >>
Synchronizing two SQL Server Databases
Posted by le_mo_mo NO[at]SPAM yahoo.com at 6/23/2006 9:57:51 AM
Hi,
I am trying to have two SQL Servers (Local/remote) synchronized. I was
wondering if there are any jobs I can run to make this happen. I have
one server defined as linked server for the other. I can not figure out
how to keep the autogenerated primary keys the same! Any ideas?
Thanks
... more >>
What kind of code in a stored procedure is actually run on client?
Posted by nick at 6/23/2006 9:38:02 AM
I created a stored procedure Sql Server 2000. There is a bug in the sp - an
infinite loop. I run it on my client pc using SSMS. And my client PC CPU soar
to 100%.
I thought the whole SP will be run on the server side. It seems it runs on
the client side? Will the data in @tableVar be sent ... more >>
paramater values inside IN clause
Posted by Pedro at 6/23/2006 9:34:43 AM
I have a problem in a stored proc where I pass more than one value to
the parameters inside a IN clause: it doesn=B4t retrieve any data. But
if there's only one value I get results.
here's the code:
CREATE PROCEDURE spGetInvoiceData
@strClient varchar(10),
@strBrand varchar(10),
@str... more >>
Adding days and setting time
Posted by simon_s_li NO[at]SPAM hotmail.com at 6/23/2006 8:59:39 AM
Hi,
Can someone please help me with a SQL Server 2005 issue with date and
time.
I want to take the current date and time and add 2 days to it, but the
time must be set to 5pm.
If the current date/time is past 5pm it will go to the next day at 5pm.
So if the date was:
2006-06-23 15:5... more >>
Multiple Inserts in the Same Stored Procedure
Posted by bradley.d.walker NO[at]SPAM gmail.com at 6/23/2006 8:41:34 AM
Hey,
I have a project that I have been working on and I need to insert a
record into multiple tables and I if any one of the inserts fails I
need to rollback all of the previous inserts that were done. To
illustrate, I have ten tables that need to have a record inserted into
them and if it e... more >>
SQL server 2005 date conversion bug??
Posted by Panos Stavroulis. at 6/23/2006 7:49:02 AM
Hi,
I have a very strange problem converting a string to a date...
See the following query
select
[RTG MDY ISSUER RATING],
mdy_rating_date,
convert(datetime,mdy_rating_date,103) rate_date
from issuer_industry_ratings_tmp I
join issuer_alias BLOOM
on I.bb_ticker = BLOOM.alias
... more >>
Strange Query Analyzer result
Posted by Brent White at 6/23/2006 6:15:41 AM
I am looking at archiving some tables. One of them is a table called
TXUYLS01. It is a fairly large table (about 650K rows). My issue is
this:
If I do this query in Enterprise Manager:
SELECT *
FROM TXUYLS01
WHERE (L1SNR <= '0000108426') AND (L1BNR = '001')
I get abou... more >>
Copy triggers between databases without copying table
Posted by SMC at 6/23/2006 6:13:01 AM
Is there any way to copy a trigger between SQL Server databases without
copying the table? In other words, is there some what to apply a
trigger to a table through a script?
... more >>
SQL 2005 updating data in SQL 2000 DB via linked server returns error
Posted by ccjjharmon at 6/23/2006 5:45:03 AM
I am attempting to push data updates via linked server from a master
database (running in a SQL Server 2005 instance) to a local database
(running in a SQL Server 2000 instance) via linked server.
I am performing the updates via stored procedures.
I know I need to configure the linked server... more >>
SqlDependency fails when not connected to domain
Posted by Jason Saidoo at 6/23/2006 5:34:01 AM
SqlDependency seems to work for me just fine when I am at work and logged
into my work domain. I attempted to demo SqlDependency outside of the office
and it simply would not work. In debugging, there are zero errors, and the
code seems to execute "SqlDependency.Start(strConnectionString)" w... more >>
search in only non tagged words
Posted by shahdharti NO[at]SPAM gmail.com at 6/23/2006 5:26:51 AM
Hi
I want to search from table for rows where value should be part of
text , but search should omit values from tag.
like
create table #t (data varchar(8000))
insert into #t values('<div> this is a div text </div>')
insert into #t values('<div> this is a text </div>')
insert into #t va... more >>
Transaction causing procedure to get progressively slower
Posted by Someone Else at 6/23/2006 5:16:08 AM
Hi Guys,
I've got a procedure that does a lot of work on a database. When run
within a transaction it gets progressively slower. It uses lots of
nasties like nested cursors down to about 5 levels, and temporary
tables all over the place.
If we run it in separate chunks it gets through the w... more >>
Need to know about Getdate function?
Posted by SouRa at 6/23/2006 4:33:02 AM
Hai,
Let me know when this function returns null value
Substring(Convert(varchar,DateAdd(MM,1,GETDATE()),107),1,3)+'
'+right(Convert(varchar,DateAdd(MM,1,GETDATE()),107),4)
regards
Soura
... more >>
BUG(?): Distinct + variables TSQL
Posted by mzacharzewski NO[at]SPAM linksoft.pl at 6/23/2006 1:49:57 AM
Hi All,
the following TSQL statment doesn't return expected value:
declare @tmp varchar(500)
set @tmp = ''
select distinct @tmp = @tmp + ',' + Col
from ( select 'A' as Col union all select 'B' union all select 'A' ) x
select @tmp
expected: ',A,B', returns: ',B'
This bug (?) relates to SQ... more >>
help me with date
Posted by amjad at 6/23/2006 1:15:01 AM
Hi i have date field. when used paratemized query from asp.net . in which
date field is null , it null the whole dynamix sql , then i decide to use
isnull function to convert null to '', i
like set @mydate=isnull(@mydate,'')
but this create another problem which it update date field with date ... more >>
time_series calculations in SQL
Posted by GB at 6/23/2006 12:19:43 AM
Hello,
I have a simple table of 2 columns: datadate ( datetime) and x (real).
Is it possible to create SQL select statement ( not UDF) which performs the
following calculations:
y = (x(t) - x(t-12)) / x(t-12).
Here t is datadate column value.
Thanks,
GB
... more >>
aggregate function
Posted by Squirrel at 6/23/2006 12:00:00 AM
The following statement fail to generate my expected result:
select A.part_id, sum( (B.total + sum(C.amount)) * D.rate)
from A, B, C , D
where B.part_id = A.part_id and C.line_id = B.line_id and convert(char(6),
B.date, 112) = D.code
It generates the error of "Cannot perform an aggregate func... more >>
Update Trigger
Posted by Paul Cheetham at 6/23/2006 12:00:00 AM
Hi,
I'm new to writing triggers, and I can't seem to get the syntax right of
this one. What I am trying to do is this.
On Update of DB1.Table1
If (Update(Table1.Completed))
UPDATE DB2.Table2
SET DB2.Table2.Completed = DB1.Table1.Completed
WHERE DB2.Table2.JobNumber = DB... more >>
Another Join / aggregate newbie request for help
Posted by henry at 6/23/2006 12:00:00 AM
Hello
I need to present som logged data from a tabel accumulated last hour and
total.
I have two tables
[analog register] AR
ID (unik PK)
SignalText (plain text, description of the datapoint)
id SignalText
----------- ------------------------------------------------------... more >>
No mapping exists
Posted by Oxns at 6/23/2006 12:00:00 AM
Hi,
Hope this is the right forum.
Calling a SQL Express database (which is working fine), from a Web Page
using C#.
Get the Exception :
No mapping exists from object type System.Data.SqlClient.SqlCommand to a
known managed provider native type
Code all looks good to me, the connec... more >>
|