all groups > sql server programming > july 2007 > threads for tuesday july 17
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
Timeout expired problem
Posted by GB at 7/17/2007 10:39:39 PM
Hello,
I have this error message when I execute my stored procedure in SSMS:
The statement has been terminated.
Msg -2, Level 11, State 0, Line 0
Timeout expired. The timeout period elapsed prior to completion of the
operation or the server is not responding.
It happened every time I run th... more >>
SELECT inside of CONVERT
Posted by 8675309TT NO[at]SPAM gmail.com at 7/17/2007 10:23:01 PM
I am trying to convert field value to the length from another table.
Basically try to truncate the data so it will fit into another
table. My question can I put the select statement in place for the
length of the varchar?
Ex...
convert (varchar(100), Field_Value)
SELECT Field_Value,
... more >>
Group by problem
Posted by GW at 7/17/2007 10:12:05 PM
Need assistance to solve the following problem:-
Master_Ac Sub_Ac name balance
1 1A ABC 0
1 1B ABC 0
1 1C ABC 0
2 1A DEF 0
2 ... more >>
BackUps
Posted by Bob at 7/17/2007 10:10:27 PM
I know there are many strategies with pros and cons for each...
that being said,
To perform a full DB backup, followed by a full backup of the
transaction log, with truncation, what is the best way to accomplish this.
I typically create a backup script in the management studio and copy it to... more >>
Update gives an insert error
Posted by Dwight at 7/17/2007 8:33:35 PM
On updating the aspnet_users table, I get an insert error. I've never
seen an insert error on an update.
'Cannot insert duplicate key row in object'
There doesn't seem to be any duplicates when do a standard select.
Thanks
Dwight
... more >>
COUNT and AVG problem
Posted by Nightcrawler at 7/17/2007 7:23:12 PM
I have the following tables and query
CREATE TABLE [dbo].[PlayList]
(
[PlayListId] [uniqueidentifier] NOT NULL,
[UserId] [uniqueidentifier] NOT NULL,
[Comment] [varchar](1000)
)
CREATE TABLE [dbo].[PlayListRating](
[PlayListId] [uniqueidentifier] NOT NULL,
[RatedBy] [uniqueidentifi... more >>
Get results of non-row returning query?
Posted by Kevin Boyles at 7/17/2007 5:14:59 PM
I am trying to use VBScript to automate some commands like DBCC, Backup,
etc. for a SQL server and then e-mail the results of those commands.
Since these commands do not return ADODB "record sets" where do I access
the results of these commands? All the Execute methods either a closed
record ... more >>
stored procedure "too many arguements specified"
Posted by Luke Davis at 7/17/2007 4:31:16 PM
I'm getting an error in visual studio that states I have too many arguements
in my stored procedure, is there a way around this limitation? If not what
is the best way to write to 30 columns?
Thanks,
--
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, S... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Codeing a Parameter string
Posted by Jim Abel at 7/17/2007 2:34:02 PM
I'm having trouble coding a parameter string that I want to use in a IN
clause later in a SQL Query. For an example,
Select theName, theAddress, thePhone
FROM aTable
WHERE theName IN ('Jay', 'Chris', 'Kris')
In the real query I want to use a Parameter but I can't seem to get the
string... more >>
IF statement errors at runtime, even though the code doesn't execu
Posted by Kyle at 7/17/2007 2:24:02 PM
I have a block of code in a SQL statement that is protected by a version
check using an IF statement. I want the entire thing to be re-runable and it
compiles, but it fails on the second run through, even though it does not go
into the IF block.
For example (pseudo code):
IF NOT EXIST... more >>
Triggers: Detecting changes in records
Posted by Gaspar at 7/17/2007 2:17:26 PM
Inside a trigger ...
- How I detected changes in records using the inserted/deleted tables?
- What if the primary key changes?
Thanks!... more >>
Stack space on subquery
Posted by DWalker at 7/17/2007 1:40:07 PM
I was using this construction to delete some "duplicate" records from a
table:
Delete From TransStagingLoad
From TransStagingLoad
Inner Join (Select SSN_TIN, Acct_Number, Seq_Num, Trade_Date,
Max(Settle_Date) As MaxSettle_Date From TransStagingLoad
Group By SSN_TIN, Acct_Number, Seq_Num,... more >>
Number of processors
Posted by KH at 7/17/2007 1:38:02 PM
Anyone know how to find the number of processors available to the server? I
can't fine anything in BOL - looked thru SERVERPROPERTY, system functions,
and system stored procs to no avail.
What I'm trying to do is run one process per processor. If you know any
other ways to accomplish that I... more >>
Populating End Date
Posted by Curious Joe at 7/17/2007 1:37:01 PM
CREATE TABLE [dbo].[price_change_all](
[ARTICLE] [decimal](18, 0) NULL,
[STORE] [varchar](4) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[VND_NO] [varchar](10) COLLATE SQL_Latin1_General_CP1_CI_AS NULL,
[BASE_COST] [decimal](11, 2) NULL,
[NET_COST] [decimal](11, 2) NULL,
[CREATE_DT] [date... more >>
Partition a table in sql 2000
Posted by bb at 7/17/2007 12:51:26 PM
Hi
How to partition a table in sql server 2000? One my table is having
4545000 rows. Its performance is very poor. Is there any way to partition it
as we do in SQL Sever 2005?
BB
... more >>
CASE in ORDER BY
Posted by Rob at 7/17/2007 12:46:02 PM
Can I use the CASE function in the ORDER BY clause?
I'd like to use either one or the other ORDER BY clause based on a
criteria... something like this:
:::::::::::::::::::::
ORDER BY
CASE WHEN PCode<>'XXX' THEN A.col1,A.col2,A.col3,A.col4,A.col5
ELSE A.col1,A.col2,A.col5
END
... more >>
filtering issue
Posted by ChrisB at 7/17/2007 12:42:44 PM
Hello,
I would appreciate any insight into this issue.
A table contains the following data (XCount only applies to items of type 1
and YCount only applies to items of type 2):
ItemID ItemTypeID XCount YCount
--------------------------------------------
1 1 ... more >>
Help with outer join
Posted by Flomo Togba Kwele at 7/17/2007 11:40:19 AM
Two tables, both of which have a column called ID (char(10)).
In table A, there are 1000 rows. Table B has over 2 million rows, but also contains rows which
should match those of Table A. However it only contains 909 rows attributable to Table B.
select count(*)
from TableA a
left outer jo... more >>
How to find out who is currently holding an application lock
Posted by Ian Boyd at 7/17/2007 11:40:01 AM
i'm trying to figure out who has the application lock on a particular
resource. For example
EXECUTE sp_getapplock
@Resource = 'Edit Ticket {3259AA76-8F02-4361-B224-1422E57C6BAE}',
@LockMode = 'Exclusive',
@LockOwner = 'Session'
The command(s) completed successfully.... more >>
ORDER BY CASE AND SELECT DISTINCT error
Posted by LW at 7/17/2007 10:56:02 AM
Hello,
I have been reading the posts and have found them very useful and have found
a way to sort my results in the order that I want either by using ORDER BY
CASE or CHARINDEX. However, I am getting an error because I am using SELECT
DISTINCT TOP 100 in the same stmt. If I remove DISTINCT th... more >>
Concatenate Name
Posted by pjscott at 7/17/2007 10:38:01 AM
I'm using sql 2000 and Access 2003.
I have a Lname, Fname and Init fields. I'm using the following to create a
Name field:
([Lname] + ', ' + [Fname] + ' ' + [Init])
If the employee has an init everthing works fine but if they don't have an
init the name field is blank. I've tried this i... more >>
SQL Enterprise Manager dts local package showing up blank.
Posted by rogoflap NO[at]SPAM gmail.com at 7/17/2007 9:59:56 AM
Recently I have noticed that I cannot see what is in a DTS local
package on our SQL 2000 Server using Enterprise Manager.
I don't know what was updated, but I can click on them but not see
anything. I know there are items in there, but now I cannot see any
of them.
I cannot see any of the ... more >>
Joining on a table which has more than 1 record
Posted by Matt Urbanowski at 7/17/2007 8:34:54 AM
Hi.
I have a table (table1) with an ID which relates to an ID value in
another table (table2).
However, in table2, there is often more than 1 record with that ID.
Take the following example:
Table1:
Table1ID Table2ID
1 1
2 2
Table2:
Table2ID ... more >>
Developer Edition with Features of Standard Edition
Posted by SQL Learner at 7/17/2007 8:31:58 AM
Because my production server is Standard Edition, I want my local
instance running Developer Edition to have only the features from
Standard Edition. I want my local instance to raise the same errors as
my production does whenever I try to use Enterprise Edition features.
How to do that?
TIA
... more >>
Joining on a table which has more than 1 record
Posted by Matt Urbanowski at 7/17/2007 8:05:50 AM
Hi.
I have a table (table1) with an ID which relates to an ID value in
another table (table2).
However, in table2, there is often more than 1 record with that ID.
Take the following example:
Table1:
Table1ID Table2ID
1 1
2 2
Table2:
Table2ID ... more >>
Where did 'Object Search' go?
Posted by Roz at 7/17/2007 7:40:01 AM
Hello all. Got a quick question. In SQL 2K, there was a tool called 'Object
Search' that you could use to search the entire db for an object (table,
view, triggers, column, etc). I can't seem to find the 'Object Search' in
SQL 2K5, or any tool/feature similar. Any ideas?
TIA,
Roz... more >>
UPDATE top 1 in a JOIN
Posted by Andy at 7/17/2007 7:38:07 AM
Hi I have this query that updates all entries, but I want to update just one
(doesn;t matter which, if that helps)
update FOO
SET Location='Z'
from FOO
join BAR on FOO.titleID = BAR.TitleID
and FOO.Location in ('A','B','C')
NB I only want to update one row in foo... more >>
CLR connection to SMTP server
Posted by justSteve at 7/17/2007 6:20:04 AM
I have an ActiveX component that lets me connect to a SMTP server but I'd
like to avoid all those calls to sp_AOxxx.
CLR is supposedly taking the place of Extended Stored Procedures (of which
several SMTP-oriented dlls exist). Has anyone implemented the equivalent via
CLR code?... more >>
Are input parameter values accessible programatically?
Posted by justSteve at 7/17/2007 6:16:03 AM
....as opposed to being accessed by name.
SQL Server 2005 Express
In the same fashion that I can get the name of the current sproc via:
SET @ProcName = OBJECT_NAME(@@PROCID)
I'd like to get the values of all input parameters of a given sproc
_without_ hardcoding the @param name. (i'm try... more >>
Getting Percentages
Posted by Kayda at 7/17/2007 6:13:45 AM
Hi:
I want to know how to get the percentages of "Yes" values relative to
the total count of records for each month. So i have a table:
DateCol YNCol
Jan 1, 8:34 Yes
Jan 2, 9:55 No
Jan30, 10:20 Yes
And I want something to mimic this (I'm using a made up functio... more >>
building a where clause..single quote problem
Posted by Bob at 7/17/2007 5:17:31 AM
Hello folks!
I'm building a where clause that looks like this (you can copy and run
this in your Query.Analyzer...it will return the sql statement)
Declare @Model varchar(50)
Declare @Customer varchar(50)
Declare @AircraftType varchar(50)
Declare @b tinyint
Declare @SQL varchar(1000)
Dec... more >>
Converting text (Jan-07) to date format
Posted by Srinivas at 7/17/2007 4:29:22 AM
I am trying to create a chart in a reporting tool. The requirement is
to display the date in 'MON-YY' format. So, I used the following
function to get it.
REPLACE(RIGHT(CONVERT(VARCHAR(9), [Availability Month], 6), 6), ' ',
'-')
But what happens is that the result is text. So when the ch... more >>
UPDATE TRIGGER PROBLEM
Posted by AliRezaGoogle at 7/17/2007 2:49:00 AM
I have declared an INSTEAD OF DELETE trigger on my table.
First: I want to know what criteria was mentioned after WHERE clause
in origional update statement. I want to add this criteria in another
statemnt of the trigger.
Second: What if multiple row is going to be affected by origional
... more >>
Transfer file structure
Posted by Peter Hyssett at 7/17/2007 2:24:01 AM
Hi.
My organisation has three tiers - head office, area office, branch. There is
one server for head office, one for each of 17 areas, the area servers having
databases for area office and all branches in the area. Entities are
regularly transferred between branches, each transfer involving s... more >>
creating 1 to 1 relationship in sql server 2000
Posted by reza at 7/17/2007 1:37:44 AM
hi guys, how can i create 1-to-1-relationship in MS sql server 2000? i
tried using the drag and drop in the table diagram but it only allows
me to create 1-to-many relationship type. do i need to do it
programmatically via query analyzer? regards.
... more >>
Bugs fixed in sql 2005
Posted by raghu veer at 7/17/2007 1:24:00 AM
can u list me the bugs of sql 2000
that are fixed in sql 2005... more >>
Help on a simple join
Posted by SwampYankee at 7/17/2007 12:00:00 AM
Hi,
I'm sure this is a stupid error but I can't get a simple join to work. 2
tables; USR_AS400_SUPPORT & TS_STATES. The common field is called
TS_ID. I want to get the TS_NAME field from TS_STATES, and the
TS_IssueID and TS_tittle fields from USR_AS400_SUPPORT. My query looks
like this:
... more >>
Integer type field constraint question
Posted by Jason Huang at 7/17/2007 12:00:00 AM
Hi,
In my SQL Server 2000, the TableA has an integer type field NoToCarry, and
the TableB has integer type field TotalNo.
Can I set up the contraint for the TableA, so TableA's NoToCarry must not
bigger than TableB's TotalNo?
Thanks for help.
Jason
... more >>
Recursion & Table variable
Posted by ManishJain at 7/17/2007 12:00:00 AM
Hello guru.
how can I pass a table variable to a stored procedure
the procedure is going to call itself..(Nested sort of.)
the nesting would be at the max 4 levels
... more >>
updating with sp
Posted by Rotsey at 7/17/2007 12:00:00 AM
Hi,
i have this huge sp below that when I update using
ADO.NET it returns 2 rows affected.
I am supposedly only updating one row as I specify the
primary key.
Any ideas please
rotsey
CREATE PROCEDURE sp_tbrnet_updateEmployees (
@EmployeeID int,
@EmployeeNumber varchar(30),
@Firs... more >>
Flummoxed by Connection Problem
Posted by DesCF at 7/17/2007 12:00:00 AM
Everything was working fine until suddenly this problem appeared from
nowhere:
Boot up the pc and go into SQL Server Management Studio. The database is
present and the data can be accessed.
Go into VB2005 Express and run the project. Everything works fine.
Open Database Explorer and c... more >>
SQL LIKE and Arabic Datafeild
Posted by mustafa.rabie NO[at]SPAM gmail.com at 7/17/2007 12:00:00 AM
Dear All,
I am developing a DBase that has Arabic Datafields, and i am
implementing a search mechanism, so i want to use the LIKE command.
But it never returns any data although i am sure that the data is
there... any suggestions?
SELECT G_id, S_id, A_id, G_Description, G_Title
FROM ... more >>
.rtf to .txt
Posted by Sathiamoorthy at 7/17/2007 12:00:00 AM
I stored a .rtf file in a ntext datatype field. After some time i want to
move the rtf format file to some other column with .txt format. Please any
one help me.
Regards,
R.Sathiamoorthy
... more >>
Help to simplify UNION/Subquery ..
Posted by hals_left at 7/17/2007 12:00:00 AM
I have a table called "CustomerContacts" that stores when staff an
interest in an organisation. In the app I need to display all
organisations with checkboxes unticked if the there is no record &
ticked if there is a record , for any particular contact.
So I need a query that I can just add ... more >>
FULL TEXT SEARCH AND RECORD NUMBER PROBLEM
Posted by in da club at 7/17/2007 12:00:00 AM
I dynamically create my query based on filter criteria , order by criteria
and paging criterias. I have no promlem at that point.
My problem is that How can i get total record number of my recordset in
stored procedure. What is the best way to get it. Should i use and output
parameter in st... more >>
|