all groups > sql server programming > november 2004 > threads for tuesday november 30
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
TSQL to find all running SQL Agent jobs
Posted by Hassan at 11/30/2004 11:13:32 PM
I've looked at sp_help_job but cant really seem to find out current
execution status . So basically I want to be able to run a TSQL that will
list all jobs that are currently running
... more >>
Isolation level question
Posted by Vicent Palasà at 11/30/2004 9:27:40 PM
Hi.
I am learning about transaction isolation levels. The problem is that I see
is that one single update (with "read uncommitted") can lock the whole
table, which does not make sense to me. I explain with an example.
I have a simple table "isolation_test" with two columns "number"(int) and
... more >>
Asynch Batch Processing Architecture
Posted by Randy at 11/30/2004 8:08:08 PM
What is the Microsoft recommended architecture for implementing a .Net
windows service that needs to do processing based on a stack of data.
e.g. I've used a Task table in sql server in the past with a IsProcessed
column. Then the windows service polls that table looking for new records
... more >>
Need Case Based Query for This Situation
Posted by Prabhat at 11/30/2004 7:46:57 PM
Hi All,
My Case is:
Table1
-------
Tid orgname lastname firstname add1 city
--------------------------------------------------------
101 NULL test1 test11 add1 c1
102 org1 test2 test22 add2 ... more >>
Query returning null set
Posted by Steve Everington at 11/30/2004 6:50:52 PM
Help!
I have a query, built up programatically (from Delphi) that returns a null
set unexpectedly. If I enter the query manually into Query Analyser then it
works as expected, but not via the program. The query executed (as captured
by SQL Profiler) is:-
exec sp_executesql N'SELECT *, ... more >>
Create table from view?
Posted by at 11/30/2004 6:47:09 PM
Is there an easy way to create a table based on an existing view?
Thanks for any help!
Ken
... more >>
Date question
Posted by Aleks at 11/30/2004 6:34:41 PM
Hi,
I have a query that returns date/time, I only want to display the records
which the date is same as today, regardless of the time, I tried:
Select * from table
Where LoginTime =getdate()
But I don't get the results I need.
How should the query be so that I only get the records whe... more >>
Newbie question about Stored Procedures
Posted by rahuls NO[at]SPAM jhu.edu at 11/30/2004 5:41:37 PM
Hi, I'm just starting out on SQL server and stored procedures. I have
a table that looks like this:
case_id text_type text_data
----------------------------------
d101 $header <long text...>
d101 $body <long text...>
d101 $footer <long text...>
d2... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
triggers
Posted by ayordy at 11/30/2004 5:21:06 PM
will an update trigger fire an insert and/or delete trigger?... more >>
need help with query statement
Posted by mitra at 11/30/2004 5:19:01 PM
Hi,
I have the following tables:
CREATE TABLE myGroup (
id_group int NOT NULL IDENTITY(1,1),
gp_name varchar(30)
)
CREATE TABLE myPolicy (
id_policy int NOT NULL IDENTITY(1,1),
policy_name varchar (30)
)
CREATE TABLE myGroupPolicy (
id_group int --FK to... more >>
How to know the sp_start_job job has failed?
Posted by Tee at 11/30/2004 4:58:37 PM
How to know the sp_start_job job has failed?
No matter the job run successfully or not, we can only know that it started
successfully.
Job 'JobName' started successfully.
Is there any way we can know the job run result?
Thanks.
... more >>
SQL XOR
Posted by Justin Drennan at 11/30/2004 4:30:08 PM
Is there an easy way to do an XOR or MOD using SQL syntax?
5 mod 2 = 1
6 mod 2 = 0
?
thanks,
Justin
... more >>
Returning Multiple Rows based on 1 rows column integer content.
Posted by Richard at 11/30/2004 4:13:03 PM
I need to select as many rows as a quantity field in one row of a table
specifies. I need this desperately!
Example:
OrderItemID, QuantityOrdered, Col3, Col4, Col5....
123456, 6, ......
My select should bring back 6 rows:
123456, 10, ... more >>
Date range
Posted by Aleks at 11/30/2004 4:06:47 PM
How can I display all records where logintime (The date only) is same as
today's date, regardless of the time ?
I tried the following but didnt work:
Select * from table
where LoginTime =getdate()
Thanks,
Aleks
... more >>
Hierarchical Data / Adjaceny list model / Moving Nodes
Posted by Raterus at 11/30/2004 3:59:11 PM
Hi,
I'm implementing this approach to storing hierarchical data in my =
database.
http://searchdatabase.techtarget.com/tip/1,289483,sid13_gci537290,00.html=
I have all the methods to add and delete, but I also need methods to =
move these nodes around. Also, I wouldn't just be moving on... more >>
Query : Help
Posted by Aneesh at 11/30/2004 3:46:28 PM
I have a table Say 'FunUse' having fields funID int, DateOfUse datetime ,
and SchemeID.
The table wiill store each usage a particular Function(funID). i need
Query to select funID, no.Of.MonthsUsed, Scheme
Thanks in advance
Regards Ar
... more >>
Zip code distance
Posted by brian.shannon NO[at]SPAM diamondjo.com at 11/30/2004 3:18:45 PM
I am looking to find the distance between one zip code and another. I have
declared @lat and @long for the default zip code that I want all distances
to be computed from. I got the below formula from a previous group post but
my calculation is way off. this formula shows a distance of 9000 mil... more >>
Variable for IDENTITY Seed
Posted by Alan Z. Scharf at 11/30/2004 3:01:15 PM
1. Is there any way to use a variable in creation of an IDENTITY column?
ALTER TABLE dbo.tblContacts
ADD NewContactID INTEGER IDENTITY(@MaxID, 1)
2. I'm trying to merge an old Access mdb data with new records created in a
new test SQLServer db.
3. I want to create a new IDENTITY C... more >>
Help - text(16)
Posted by Fredrick A. Zilz at 11/30/2004 2:36:57 PM
I have an aspx form that contains a textbox control. The controls text value
is stored in a sql database table in field of type text (16). When I do a
select * from Table the results appear to be cut off at the 500 character
mark.
Is this do to the way I am retrieving the data? The way I a... more >>
T-SQL v.s. SQL-92, Advantages and disadvantages?
Posted by Victor Feng at 11/30/2004 2:21:10 PM
As a programmer, which one should we use between T-SQL and SQL-92? Why?
Thanks
Victor... more >>
Help with UPDATE STATEMENT
Posted by Munch at 11/30/2004 2:19:02 PM
Here is some sample data.
ID INITIAL NAME SEX HIREDATE STATDATE STA ACT REA ENDDATE
123456 AA SMITH M 19680513 19680513
123456 AA SMITH M null null A
123456 AA SMITH M null null A
123456 AA ... more >>
NULL's in JOIN expression
Posted by Mike Labosh at 11/30/2004 1:42:11 PM
Just confirming the behavior of NULL values in a column that gets Joined on:
FROM SampleSourceProfiling ssp
INNER JOIN SampleSourceArchive ssa
ON ssa.SampleSourceArchiveKey = ssp.SampleSourceArchiveKey
INNER JOIN AlternateCity ac
ON ac.AlternateCountryKey = ssp.CountryKey... more >>
Access - SS differences
Posted by G Dean Blake at 11/30/2004 1:29:48 PM
I'm converting an Access app to asp.net using SQL Server and am running up
onto all kinds of things Access has that SQL Server can't seem to do. My
latest is demonstrated by the following example:
SELECT Products.UnitsInStock AS UIS,
Products.UnitsOnOrder AS UOO,
UOO+UIS AS MYSUM
FROM Pro... more >>
Update all records but a few
Posted by Drew at 11/30/2004 1:10:58 PM
I need to update our database for all users, except for a handful (9
people). How can I do this?
I have tried the following,
UPDATE tblEmpInfo SET
EmpNewSalary = EmpSalary * 1.03
FROM tblEmpInfo EF INNER JOIN EmpCore.dbo.tblEmployee E ON EF.EmpID =
E.EmpID
WHERE EmpActive = 1 AND (Emp... more >>
sql server name problem
Posted by JFB at 11/30/2004 12:42:09 PM
Sorry if I'm posting twice but I need help with this.
Hi,
I have a problem with my server name.
When I use sp_helpserver it give me 'myServerName' with id = 0
when I use select @@servername it give me 'myServerName'
when I use select SERVERPROPERTY('myServerName') it give me NULL
I try this to... more >>
How to convert the format of a date
Posted by mitra at 11/30/2004 12:37:07 PM
Hi,
Our java application stores date in a column in float data type (e.g.
1101254691000)
I need help to convert the format of the above date to a datetime format
like "11/30/2004 1:30:52PM" and a datetime format like "November 30, 2004 -
1:30:52 PM
Thanks so much for the help!
--
... more >>
SP Timeout in VB
Posted by Lee at 11/30/2004 12:31:08 PM
I have a stored procedure that I can execute in the Query Analyzer which will
return 29 records in 8 to 15 seconds. When I execute that same stored
procedure with the same parameters from VB (MDAC 2.7 or 2.8, or VB.NET 2003
SQL Data Providor) the procedure always times out regardless of the ti... more >>
Query based on Date??
Posted by Brad M. at 11/30/2004 12:26:03 PM
Issue I am having is below DDL and Sample Data.
CREATE TABLE [PayrollRates] (
[PayrollRateID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NOT
NULL ,
[EmployeeID] [varchar] (50) COLLATE SQL_Latin1_General_CP1_CI_AS NULL ,
[EnteredDate] [datetime] NULL ,
[EffectiveDate] [datetime]... more >>
isnull versus is null
Posted by JimW at 11/30/2004 12:23:03 PM
Can anyone explain why the following query does not work. I am running this
query against a view and 2 tables.
The view looks like this:
CREATE VIEW TTM_DayLightSavings
AS
select
IntervalDayId
,MonthInYear
,CAST('Y' AS CHAR(1)) DayLightSavingsInd
from
(
select
IntervalDay... more >>
I get multiple line for same ID?
Posted by mttc at 11/30/2004 12:21:39 PM
Sql 2000
I have table with ID column as primary key with Identity.
Have also in this Table bit field with Null not allowed and secondary key.
When I write select like:
Select ID from table where BitCollomn=1
I get multiple line for same ID, what is can be it?
... more >>
Date W/O Time Query Question
Posted by Bishop at 11/30/2004 12:18:29 PM
MS SQL 2K
I need to retrieve each record for a specific date and ignore the time. I
was thinking something along the lines of the query below, replacing "Day"
with the appropriate keyword but can't seem to find one that does what I
need. I guess I could use a combination of Day, Month, a... more >>
how to exclude weekends from a datediff?
Posted by meg at 11/30/2004 12:06:53 PM
Hi, I am not sure how to implement a query where I have to find the difference between two dates but exclude
weekends and company holidays. I did figure I would use datepart or datename somehow but I'm not sure how. I
have a table that lists company holidays as well - but being a beginner at wri... more >>
Connections
Posted by John at 11/30/2004 11:55:52 AM
Is there a maximum number of connections allowed in sql server?... more >>
Binary File transmission
Posted by Mel at 11/30/2004 11:48:08 AM
Hi everybody,
is it possible to use the SQL Server connection to transfer a binary file
from a server (with SQLServer) to a client?
My idea is to create a Stored Procedure that use a Image variable to read
the file from a server's folder and send it to the client (the client calls
this Stored P... more >>
create a procedure in other server
Posted by Britney at 11/30/2004 11:34:04 AM
hi, I'm in server A,
I want to create a procedure in Server B, database1
now, assuming that I must stay in Server A to do this,
is it possible?
will this work ?
CREATE PROCEDURE <Server B>.<database1>.<dbo>.<Procedure Name>
................
.................
... more >>
Import new records with dup checking
Posted by Dennis Burgess at 11/30/2004 11:28:50 AM
I have the following Query
INSERT INTO customer
(Salesrep, First_Name, Last_Name, City, Phone_1,
Phone_2, dt, Store, comments, newused, make, model, ZIP, State)
SELECT Name AS Expr1, First_Name AS Expr2, Last_Name AS Expr3, City AS
Expr4, Home_phone AS Expr5, Work_Pho... more >>
running job without being the owner?
Posted by Patrick at 11/30/2004 11:00:26 AM
Hi Freinds,
SQL 2000
Is that possible without making a user the owner of job, have her ro run and
view the job?
The account is not an SA eaither.
Thanks,
Pat
... more >>
Beginner's question
Posted by Sericinus hunter at 11/30/2004 10:45:53 AM
Sorry, looks like this is very well known, but still...
What is BOL?
Thank you.... more >>
restore a sql server 2000 database to msde from a bak file
Posted by TJS at 11/30/2004 10:39:32 AM
Can I restore a sql server 2000 database to msde from a bak file ?
if so how ?
... more >>
Copy one colum from one table to another with same structure
Posted by Pedrito Portugal at 11/30/2004 10:37:02 AM
hi!
How can I copy the data from one table to another one?
The both tables has the same structure.
This statment doesnt work:
UPDATE TipoMovimento2 SET TM_Descricao=(SELECT TM_Descricao FROM
dbo.TipoMovimento)
TipoMovimento
------------------
TM_ID TM_Descricao
1 Alimentacao 1 0... more >>
BLOB Field with vbNewLine Query Help
Posted by Jim Lou at 11/30/2004 10:26:20 AM
Hello,
I have a Access form that writes a record when anything is changed. This
record is written to a MEMO field with a vbCrLf after each one. This is
done so when the form is opened, the text box will have each change
written as a New Line.
This MEMO Field is written to a Link Table in S... more >>
Generating crosstab-like tables dynamically
Posted by jhoge123 NO[at]SPAM yahoo.com at 11/30/2004 10:24:19 AM
I'm working on a product comparison site that has a table listing all
attributes of all products in this layout:
Create Table ProdAtt(
Product varchar(50),
AttributeID int not null references Attributes,
AttVal varchar(255)
)
This schema is used so that DML is not required to add new ... more >>
simple query optimization
Posted by Paul Pedersen at 11/30/2004 10:18:35 AM
I have a query that (simplified) looks something like this:
SELECT events.timeslot, events.leader1,
SUM(CASE WHEN attendance.paymethod = 'CASH' AND attendance.reversed = 0 THEN
attendance.amount ELSE $0.00 END) AS cashrec,
tchr1.persname AS teacher1
FROM events
LEFT OUTER JOIN attendance ON... more >>
Building datagrid with unknown columns
Posted by jhoge123 NO[at]SPAM yahoo.com at 11/30/2004 10:11:44 AM
I'm working on a product comparison site where the user can pick from
a list of products and then see a comparison between the two.
The data is normalized in an attributes table with the following
layout:
PRODUCT
ATTRIBUTE
VALUE
I want to make a datagrid to show the comparison between t... more >>
DISTINCT and EXISTS
Posted by scuba79 at 11/30/2004 10:07:03 AM
I'm about to ask a really stupid question.
I have a table that contains phone number and a separate field that contains
nvarchar data.
Here is DDL
CREATE TABLE [PhoneTest] (
[PhoneNumber] [nvarchar] (10) NULL ,
[ALID] [nvarchar] (6) NULL
) ON [PRIMARY]
GO
INSERT INTO PhoneTes... more >>
SQL Coding Standards
Posted by CJR at 11/30/2004 10:01:04 AM
All
Is anyone able to point me towards a "best practise" SQL coding standards
document?
thanks in advance
Chris
... more >>
Need a query that returns third highest salary row
Posted by Kiran at 11/30/2004 9:47:03 AM
Hi,
I have an Employee Table. I am looking for a query that returns a row which
has third highest salary.
Thanks
Kiran
... more >>
Choose function
Posted by G Dean Blake at 11/30/2004 9:07:27 AM
I am converting an Access application to an ASPX.net. I have come accross
some SQL that uses a "Choose" function that is apparently unknown in SQL
Server that works in Access SQL. Is there any comparable function in SQL
Server?
Thanks,
G
... more >>
Count
Posted by Myles at 11/30/2004 8:39:06 AM
Is there a way to return a Count (of rows) when you need to base the number
(count) on the distinct values of two (or more) columns? If possible, I do
not want to return a result set and then do a count -
the current application of this is for detailed reports, where I need to
show a valu... more >>
Problem with CAST and scientific notation
Posted by Keith Macdonald at 11/30/2004 7:49:12 AM
Just found a problem extracting numbers from strings and converting to INT.
Something like this
DECLARE @ParamString varchar(8000)
DECLARE @ParamCode varchar(50)
DECLARE @ParamValue varchar(100)
DECLARE @PostID BIGINT
SET @ParamString = '/forum/viewPost.aspx?post_id=1000939'
... more >>
Trying to creatively work around 8000 Character limit with sp_executesql
Posted by markheimonen NO[at]SPAM gmail.com at 11/30/2004 7:23:02 AM
I have a situation where it would be very handy to use a database
trigger to dynamically re-create a stored procedure within our system.
We have many copies of a very similar database structure, which vary
depending on the system's configuration.
In any case, our situation is a little problem... more >>
Select row that has next highest value to passed in value
Posted by John at 11/30/2004 6:05:04 AM
Hi I am a newbie and am not sure how to ask a question,
If i had an int column named test in table1 with 3 rows in it with the
values 4, 10 ,15 how would i write a sproc that would find the record with
the next highest value to the number I had passed in or if the passed in
number equaled one... more >>
Query the data returned by a stored procedure
Posted by Craig HB at 11/30/2004 6:03:03 AM
Is it possible to query the data returned by a stored procedure in the same
way you can with a view / function.
Something like this...
select * from (exec MyProc 12, 'London')
where FirstName = 'Tom'
Craig... more >>
Trying to Execute a file using exec master.dbo.xp_cmdshell
Posted by heruti NO[at]SPAM lycos.com at 11/30/2004 5:20:47 AM
hi, I have this file I need to execute from an ASP client. since we
have installed it on the SQL Database server machine, I thought I
could run it
like this:
Set Cn = CreateObject("ADODB.Connection")
Cn.CursorLocation = adUseClient
Cn.ConnectionTimeout = 0
Cn.Open sConnString
... more >>
error with group by query?
Posted by Andrzej Jakubowski at 11/30/2004 5:13:09 AM
Hello,
I have got query that uses group by statement.
GROUP BY DATEPART(month,start_date)
In select statement of that query a have got subquery that uses it.
It looks like this:
SELECT DATEPART(month,start_date) AS miesiac, sum(work_days) AS suma,
(
SELECT COUNT (id_employee) ... more >>
about execute storeprocedure with parameter
Posted by kcobain at 11/30/2004 5:09:01 AM
hello:
How can I run(or call) a sqlserver storeprocedure with parameter from Access
vba,
for example, i have a storeprocedure like :
create procedure xxxtest @loginacco nvarchar(10)
as
insert into xxxtable (loginacco) value (@loginacco)
usually i can call storeprocedure like docmd... more >>
Getting the result set from a SP
Posted by Sathya at 11/30/2004 4:29:05 AM
Hi,
I'm calling one SP from the other. The called SP returns a result set. How
can I capture that?
I don't want to use temporary tables coz...I cannot modify the called SP.
Actually the scenario is this...
I'm calling a SP to perform some action but it is returning a result set. I
wan... more >>
SQL Logic
Posted by Mal at 11/30/2004 2:59:01 AM
Hi
I've got a question about how SQL goes about creating indexes with wizards
for view and tables. How does sql decide which columns to generate indexes on
and apply other properties, surely if you know everything going on behind the
scenes some things might be alot easier to understand.
... more >>
BCP
Posted by Sri at 11/30/2004 1:39:07 AM
Can I append data to the existing file using either BCP query out or BCP out
from table or query.
Thanks in advance... more >>
Column aliases in select
Posted by Marek Cvrk at 11/30/2004 12:39:03 AM
Hi!
Does anybody know, why is not possible to use column aliases in defining
other columns in select or using aliases in where clause?
It is common feature of relational database systems.
Thank you for answer.
Marek... more >>
|