all groups > sql server programming > october 2007 > threads for monday october 22
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
A Select query to select records between 2 date and time values
Posted by Craig at 10/22/2007 11:12:57 PM
hey everyone.
I need a query that will select records from a table based on the date
and times.
Basically, it's to do with different employee shifts, especially the
ones that cross midnight.
How would I construct a select statement to get all shift details that
fall between the periods 2... more >>
DML Trigger not found in INFORMATION_SCHEMA.ROUTINES
Posted by Yan at 10/22/2007 9:44:26 PM
Hi,
SQL Server 2000 sp4
I have a DML trigger on a user table which can be found in systemobjects but
when quering INFORMATION_SCHEMA.ROUTINES for ROUTINE_NAME LIKE '%myTrigger%'
the trigget is not found.
What I actually would like to know is the date when the trigger was created
or ... more >>
get the field description
Posted by rodchar at 10/22/2007 7:41:01 PM
hey all,
is there a way in a select statement to get the description property for a
field?
thanks,
rodchar... more >>
SPROC challenge ! Can you do this ?
Posted by Tom at 10/22/2007 6:04:58 PM
My sproc recieves an account # then it loops thru multiple databases
and inserts matching records into a temp table. When this process is
complete, my temp table has these fields populated. POnum,
activitydate, amount, sstatus.
I now wish to change the sstatus column, grouped by POnum, to the... more >>
Select CrossTabs
Posted by icanhelp33 NO[at]SPAM gmail.com at 10/22/2007 4:43:01 PM
I have a data like this:
Id LastName Activity ActivityQty
----------------------------------------------------------
1 Tiesiera Fun 2
1 Tiesiera Eat 3
1 Tiesiera Run 4
I want data to look like this. I want r... more >>
Summary View of Hourly Rollups
Posted by Karch at 10/22/2007 4:37:43 PM
I have two tables, one contains the IP Addresses of servers that should be
receiving updates (called deliveries):
CREATE TABLE [dbo].[tbl_Server](
[ServerID] [int] IDENTITY(1,1) NOT NULL,
[ServerIPAddress] [nvarchar](256) NOT NULL
)
The other table contains the deliveries by hour, rolle... more >>
Ceiling() function
Posted by Loren Dummer at 10/22/2007 4:37:31 PM
I am working with the ceiling() function and am getting unexpected results.
In the BOL it indicates the ceiling function returns the smallest integer
greater than, or equal to, the specified numeric expression. I was thinking
all the below queries would return 2.
If I run the following q... more >>
Finding out whether someone is logged in or out with single query
Posted by Claire at 10/22/2007 4:18:15 PM
I have a logins table
logins
fk_users_recID = id of the user
LogDate = date of logging in/out
InOrOut = 0 or !0. 0 = logged out, any other value = logged in
Every time someone logs in or out a 1 or 0 is written into the logins table
The following query gives me a list with 2 records for ea... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Deadlock error when using Select statement
Posted by Steve Zimmelman at 10/22/2007 4:16:46 PM
I have an application that is getting a few deadlock errors while running
some Select statements for reports.
It is running against a database that is in use by an application I didn't
write.
Is there any way to avoid deadlocks for simple queries? I'm using ADO
against SQL Svr 2000.
... more >>
Select question
Posted by Joe at 10/22/2007 4:13:05 PM
Hi,
I think this should be easy, but I can't find the answer...
I need to combine a column from two seperate tables.
So, if Bill, Susan, Fred are 3 rows in TableA, and Cindy, Linda and Mike are
3 rows in TableB, I need a result of 6 rows (only one column) with Bill,
Susan, Fred, Cindy, ... more >>
Temp Table, Variable Table and Derrived Table -- Which one is faster
Posted by at 10/22/2007 3:54:48 PM
Hi
I have a complex query that I need to use temp tables.
it goes something like this
source >> Temp1 >> temp2>>Temp3>>Temp4>Temp5>>Destination.
my question is what is the preferred way to do this?
I can put them in tempt tbles or Variable , and derrived tables.
However, which one is the mos... more >>
Overhead of a Local Partitioned View - sql 2005
Posted by Jay K at 10/22/2007 2:39:02 PM
I have a view across two similar tables in two seperate databses on the same
server. I have noticed that the query runs faster accessing a table directly
when compared to accessing a single table trhough the view. (Well defined
constraints is available on the tables).
But when I create a vi... more >>
select rows that contain both arg1 = 'x' and arg1 = 'y'
Posted by Rich at 10/22/2007 1:58:01 PM
CREATE table #tmp1(sName varchar(20), code varchar(1))
SELECT 'burns', 'x'
UNION ALL SELECT 'burns', 'y'
UNION ALL SELECT 'smith', 'x'
UNION ALL SELECT 'smith', 'y'
UNION ALL SELECT 'smith', 'z'
UNION ALL SELECT 'jones', 'x'
UNION ALL SELECT 'jones', 'y'
UNION ALL SELECT 'van', 'x'
UNION ... more >>
Select Rows as column
Posted by brandon at 10/22/2007 1:34:05 PM
Is it possible to write select so the rowsa are selected as a column.
... more >>
Help With Select
Posted by brandon at 10/22/2007 12:02:50 PM
I have follwoing tables:
1. Events table
Column:
1. EventId(int) PK
2. EventName(varchar(36)
2. Registration table
Column:
1. RegistrationId(int) PK
2. EventId(int) FK
3. RegistrationFee(money)
4. LateFee(money)
5. FirstName(varchar(36))
6. LastName(varchar(36))
3. EventMeal ta... more >>
RESTORE VERIFYONLY OUTPUT
Posted by gv at 10/22/2007 11:11:30 AM
Hi all,
How would I capture the output of the results of the code below?
I want to check the file if "The backup set is valid." or not
before I restore. This will be automated.
I will send an email to a few people if not valid.
DECLARE @cmd VARCHAR(1000)
SET @cmd = 'RESTORE VERIFYONLY FROM... more >>
Could not find stored procedure problem on sql 2005
Posted by huohaodian NO[at]SPAM gmail.com at 10/22/2007 11:06:33 AM
Hi,
I have a stored procedure call logger with some simply code
create procedure logger
@file varchar(100),
@msg varchar(3000)
AS
declare @FS int, @OLEResult int, @FileID int
execute @OLEResult = sp_OACreate 'Scripting.FileSystemObject', @FS OUT
IF @OLEResult <> 0 raiserror... more >>
Access adp and sql server 2005 form
Posted by Jane at 10/22/2007 10:11:41 AM
how do you set the control source of a text box on a form using a
conditional statement in an adp using sql server 2005? Original code for
controlsource looks like this:
=IIf([nomen_dif]=True,[UNITNOMEN],"")
I have tried many versions including case statements and if statements but
nothing ... more >>
How to get to know the table updated time quickly?
Posted by Michael at 10/22/2007 10:08:52 AM
Hi,
I wanted to know the table last modified time quickly. What shall I
do? I am using MS SQL 2000. Thanks!
Michael
... more >>
Help with the SELECT statement please.
Posted by Lam Nguyen at 10/22/2007 9:11:04 AM
Hi all,
I have two tables and want to matching CustEmail against our SourceEmail and
return custid and email below. The
SourceEMail has multiple email columns so how do I compare against each
column 1 - 5. Please see the results
show below. Any help would greatly APPRECATE.
IF OBJEC... more >>
Select Syntax for a Quarter
Posted by Ryan Mcbee at 10/22/2007 8:43:01 AM
I am trying to build a Quarterly Report and would like to know how to build
syntax to tell me what quarter that the date column is in. My date column
looks like this; "2014-01-01 00:00:00.000". The column name is
upr30100.Chekdate.
Thanks,
Ryan... more >>
Query performance on view is slow (sql 2005)
Posted by Jay K at 10/22/2007 8:32:00 AM
Setup:
I have two huge tables (table1, table2) millions or records in two databases.
Both the tables have the necessary indexes, constraints etc.
The tables are split based on the columns "year"
constraint "< 2000" in table1, ">= 2000" in table2
I have a view(ALLDATA) as select * from table1... more >>
sql 2005 recursive query
Posted by Janet at 10/22/2007 8:23:02 AM
Trying to figure out recursive queries, but having a bit of trouble applying.
I have a table with:
wid - keyfield, not null
parentID - int
start_date - smalldatetime
title -varChar(100)
The structure is that if parentID=0 then it's the base of the lookup,
meaning parent, but parentID co... more >>
common table expression
Posted by Roy at 10/22/2007 8:20:27 AM
I have a common table expression query. I can run it successfully in the
management studio. However, if I copy the same query to my SqlCommand and run
it, it will show an error with
[System.Data.SqlClient.SqlException]{"Incorrect syntax near the keyword
'WITH'."} System.Data.SqlClient.SqlExc... more >>
Using the round function
Posted by C at 10/22/2007 8:19:23 AM
Hi,
I have values like 0.50000000 which I want to round up to the nearest whole
number. In this case I want to round 0.50000000 to 1
select round(0.50000000, 10)
How can I do this using the round function?
Seems straight forward but cannot see what to do.... more >>
Ole Automation Procedures
Posted by MGBloomfield at 10/22/2007 8:11:03 AM
EXEC sp_configure 'show advanced options', 1
RECONFIGURE
GO
EXEC sp_configure 'Ole Automation Procedures', 1
RECONFIGURE
GO
When I execute the above statements on my local server, the 'Ole Automation
Procedures' option is available. It is listed between 'network packet size
(B)' and 'ope... more >>
Insert Trigger fired after inserting an empty set of rows?
Posted by Alex Castillo at 10/22/2007 7:39:14 AM
Hello...
Using MS SQL 2000, I noticed that an Insert Trigger gets fired when
inserting an empty set of rows, i.e. issuing an
INSERT INTO [target_table] ([column_list]) SELECT [column_list] FROM
[source_table]
where the SELECT clause returns no rows. Is that an standard behavior?
... more >>
How to get a list of table names in one server/database
Posted by Michael at 10/22/2007 7:20:36 AM
Hi,
I want to get a list of table names in one server/database. Say I want
to get a list of table names in WorkDB database on ABC server. Could
you show me the sample code?
Thanks a lot!
Michael
... more >>
Select problems
Posted by roblowein at 10/22/2007 7:01:31 AM
Hello,
the query below returns the data I am interested APART from there
there is no value for JobItems.StaffID where NULL is returned of
course.
What I would like to happen is when there is no value for
JobItems.StaffID to get the value from a different table,
JobEngineer.EngineerID. I ha... more >>
SQL Advice
Posted by cmw at 10/22/2007 6:59:10 AM
Hello all,
I have a need to display data as shown below.
Z01 - Test, Z23 - ESFAS, Z50 - Hello World.
The data structure is
activity id project
1 Z01 - Test
2 Z23 - ESFAS
3 Z50 - Hello World
The catch is that I can't use a stored procedure. Also there is no
limit to the number of p... more >>
function look into an table
Posted by olli_d at 10/22/2007 5:32:04 AM
I have a problem: I need a function, which look into two tables.
the first table must have da date. the second table has many fields
and many records. now i must read the newesd, oldest, dateand compare
with the date in the first table.if the date is not the same, then
write the oldest date int... more >>
String function
Posted by vanitha at 10/22/2007 2:12:01 AM
hi,
i want to retreive number of characters before backslash(\).
Example
Reference_no
23424/456456
the number of characters before backslash is 5.
please help me to solve this.
thank you
vanitha... more >>
HELP: Forbid duplicate fields... unless field is '', then duplicates are ok
Posted by \ at 10/22/2007 12:35:06 AM
-- Using MS SQL Server 2000
-- Ok... I give up... what's the proper syntax here?
-- I want MyField to be unique in every row... EXCEPT if the field is ''
(then duplicates are ok)
DROP TABLE #MyTmpTable
CREATE TABLE #MyTmpTable
(
MyField VarChar(9) NOT NULL DEFAULT '',
CONSTRAINT U... more >>
Error with variable not supplied - but is
Posted by tshad at 10/22/2007 12:22:19 AM
Running on Sql Server 2000 I have the following statement that was generated
from my vb.net code. I got the actual line sent from my profiler and put it
in Sql Query Analyser and got the following message:
Server: Msg 201, Level 16, State 4, Procedure AddUser, Line 0
Procedure 'AddUser' exp... more >>
@@IDENTITY question
Posted by Rob Meade at 10/22/2007 12:00:00 AM
Hi all,
I was planning on using the above in my stored procedure to get the ID of
the row just inserted. My data type for the ID field is uniqueidentifier
and when I try to save the query it errors telling me that my @MessageID
which is declared as a uniqueidentifier is not compatible with... more >>
|