all groups > sql server programming > february 2005 > threads for sunday february 27
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
Counting rows by a dynamic SQL statements
Posted by Joel Leong at 2/27/2005 11:46:12 PM
I need to count number of record return by a SQL statement. Any idea to do
this?
This is the sample SQL. You can try in Northwind database.
The subquery inside COUNT() expression actually is a dynamic sql which I may
change it anytime. My primary purpose is to get number of record after I ... more >>
Obtaining Running Totals
Posted by Jeff B. at 2/27/2005 11:44:06 PM
I am working on a report and need to figure out a way to come up with
running totals based on a column value. Let me explain...
As shown in the query below, I am displaying "totalmealsize", "minmealsize",
and "maxmealsize" for a particular interval number (which can be anywhere
between 1 a... more >>
TSQLBlack belt Question
Posted by HSalim[MVP] at 2/27/2005 10:49:18 PM
Hello All:
I recall reading a T_SQL blackbelt article that posed a challenge along the
lines of what I need to do now - I cant seem to find that article though, so
I thought I'd post it here. i am looking for an elegant way of doing this
and all I can think of tonight is some blocky code.
A... more >>
How can I select rows where the time is midnight
Posted by Royboy at 2/27/2005 10:43:05 PM
I have a datetime field in a table. I want to extract a list of distinct
dates where the time is set to midnight.
In DB2 I could have something like
Select DISTINCT TABLEA.FIELDDATE From TABLEA
Where Time(TABLEA.FIELDDATE) <> '00.00.00'
I have looked through the online books but I ... more >>
BEGIN TRAN increments @@TRANCOUNT to 2
Posted by rejki at 2/27/2005 9:37:02 PM
I have a problem with the below code that seems to open 2 transactions(why
not just one) - what am I doing wrong?
Regards,
Janusz
SET IMPLICIT_TRANSACTIONS ON
GO
BEGIN TRAN
COMMIT
PRINT 'After commiting trans. Opened trans::' + convert(varchar,@@TRANCOUNT)
... more >>
DB Design Question (one column different numeric types)
Posted by LP at 2/27/2005 9:16:57 PM
Hi,
I am bouncing around a few design ideas for statistical database. I have a
design where one table holds all stat measure unit:
CREATE TABLE [dbo].[Stats] (
[StatKey] [int] IDENTITY (1, 1) NOT NULL ,
[StatyTypeKey] [int] NOT NULL ,
[StatMeasure] [decimal](18, 3) NULL
)
This table w... more >>
Avoiding WHERE IN
Posted by davidol NO[at]SPAM hushmail.com at 2/27/2005 9:09:30 PM
This query seems to run particularly slowly, is there a way to rewrite
it without using IN?
id fruit_name
14 Apple
34 Apple
37 Banana
56 Banana
66 Banana
78 Pear
103 Orange
select * from my_table
where id in (
select max(id)
from my_table
group by fruit_... more >>
need help with unique SQL data view
Posted by dbj at 2/27/2005 8:15:03 PM
The objective here is to create a SQL data view of two tables that have a one
to many relationship. The two tables represent a simple category/subcategory
relationship and the common value that will need to be returned will be the
name and its primary key (unique identifier). Let me represen... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
How Do I: Get a Stored Procedure's return value : Using ADO.NET
Posted by Russell Mangel at 2/27/2005 8:07:54 PM
Problem:
Unabled to get Stored Procedures Return Value:
i.e.
return (Int32)sqlCommand.ExecuteNonQuery(); // Does not work.
Question is it possible to do this?
==========
I know how to get values using Output parameters.
I just want to know if I can get SP return values directly.
======... more >>
Newbie need help on trigger.
Posted by Jensen bredal at 2/27/2005 7:59:09 PM
Hello,
I need to write a trigger that removes repeated elements on a table.
I want to delete every row where the field "name" has beenrepeated.
Any hel in writing such a trigger would be so much higly appreciated.
Many thinks in advance
JB
... more >>
List all indexed views in a DB
Posted by Hassan at 2/27/2005 6:15:33 PM
How can I list all the indexed views in a DB ?
... more >>
SQL Email when field is updated
Posted by Lontae Jones at 2/27/2005 5:47:01 PM
I hava table called Escallation has one column Calls varchar(50). Data is
inserted into this table from a DTS package. An excel spreadsheet daily.
When a value of ASAP12 enters this column in this table is it possible to
have SQL send me an email?... more >>
Counting votes
Posted by dw at 2/27/2005 4:41:16 PM
Hello, all. We have a student election application where we need to
determine:
- Total votes for each candidate in each category
- Total votes for all candiates for that same category
Here are the tables: tblVotes holds the students' votes; tblNominees holds
the candidates for the v... more >>
question about DBCC checkident
Posted by Amol at 2/27/2005 4:12:58 PM
Hi all,
In our application we use a special table(only 2 columns, one of which
is identity) to generate unique keys to use in our client application.One of
my recent requests was to create a procedure that would reserve a set of
keys in the table and return it to client.
The procedure I ... more >>
Graphical Execution Plans
Posted by Damien at 2/27/2005 1:41:02 PM
I'd like to learn how to read the graphical Execution Plans, but am not
finding BOL particularly helpful. For instance it doesn't really comment on
which elements are more desirable like Clustered Index Scans, or how to
improve a query, like if your plan is full or table scans, consider some ... more >>
unique data
Posted by newguy at 2/27/2005 1:09:02 PM
I am new to programming SQL and this is just for a class project but I cannot
figure this out.
How do I return unique data from a query? I have a table that has details
about computers. I need to return all the different versions of the operating
systems. It looks like I could do this by c... more >>
recreate index
Posted by Aaron at 2/27/2005 12:33:11 PM
I need to create a new index column for a table, because my current index
has a lot of skipped number. (ex. 1101,1102,1105,1106,1112...I know this
doesn't matter to the program but I have to do this for design purposes)
I want to make it (1,2,3,4,5,6,7,8) what is the best way to fill a new
co... more >>
Parameter problem..help is needed please
Posted by Nab at 2/27/2005 10:52:37 AM
Can someone please help identify where the problem exist in this code. A
connection with an Access database (in this case)is established through the
GUI. The snippet of code is aimed to implement two parameters: an input
parameter and an output parameter. The user inputs a value in textbox1 to... more >>
Using master..xp_logininfo
Posted by Norbert Meiss at 2/27/2005 10:07:01 AM
Hi,
I try to use Exec master..xp_logininfo @strAccount, 'all' in a stored
procedure. It works fine as long as the account in @strAccunt exists. If not
the message "Server: Msg 8198, Level 16, State 22, Procedure xp_logininfo,
Line 58
Could not obtain information about Windows NT group/user x... more >>
Again...
Posted by Jim Little at 2/27/2005 4:50:22 AM
I don't know how newsgroups work, but I added detail to a thread that was
never finished. I'm afraid no one will see it. It's entitled "Distinct and
Group By", and it is also dated 2/26/2005.
Thank you,
-- Jonathan
... more >>
|