all groups > sql server programming > november 2006 > threads for wednesday november 1
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
Bubbling up error messages: Nested Stored Procs
Posted by MarkusJNZ NO[at]SPAM gmail.com at 11/1/2006 9:29:28 PM
Hi, I have a stored procedure which calls another stored procedure
I would like to be able to capture any errors returned by the child
procedures in the parent.
I thought I might be able to do something like this (Given two stored
procs) A and B
create procedure A
as
begin
exec B
if@@... more >>
query to return the highest of a group of calculated totals
Posted by rob.fulwell NO[at]SPAM gmail.com at 11/1/2006 9:28:00 PM
I have a query that calculates the number of times a given bug has been
hit:
SELECT Count(*) As CrashCount
FROM Crashes
WHERE (BugNumber = @UserBugNumber);
Now I want to know which BugNumber would return the highest number for
that query if that query iterated across all Bu... more >>
generate serial number
Posted by vanitha at 11/1/2006 8:27:01 PM
hi,
in the select query i want to generate a serial number for each record.
example
s.no order_count customer
1 3 sdfsdf
2 56 sdsdfs
thanks
vanitha... more >>
Unique records query
Posted by Stewart at 11/1/2006 5:11:02 PM
Hello,
I am having problems with a query. I have a database that tracks drawings
and the revisions of the drawings. I need a query that pulls a list of
unique drawings with their most recent revision number. Table is as
follows:
DrawingID
RevisionNum
Notes
So if a sample of data ... more >>
select * from sp_databases ??? How to read result set in TransactS
Posted by Milan Durovic at 11/1/2006 5:02:02 PM
Hi all,
I want to be able to read the result set created by a stored procedure in my
Transact SQL script. I already know how to do this from ODBC, but I'm
restricted to using just script now.
And another one: if the stored procedure returns multiple result sets, how
do I read them one by... more >>
Updatable cursor not working with Order By when I need select in a specified SORT order
Posted by dramzanali NO[at]SPAM gmail.com at 11/1/2006 4:48:12 PM
I need to alphabetized data within a table (structure) for various
lists (structure_name).
The following cursor gives an error as the Order By makes it a Read
Only cursor.
I need to have a mechanism to do it often for various small lists and
cannot use the temporary table approach
Can yo... more >>
Left Outer Join not showing records for left table when right blan
Posted by Groucho at 11/1/2006 4:01:02 PM
I asked this in the Access adp section and didn't get a response, so I am
asking here as it appears to be more of a SQL question than just an ADP
question.
I need to show the total number of hours entered for employees in a view with
a group by, sum and where clause. I need all employees t... more >>
String comparison performance problems
Posted by Matt at 11/1/2006 3:56:21 PM
On SQL Server 2000 SP4, I am seeing a situation where two similar
SELECTS have markedly different runtimes. SQL 2005 is not displaying
this behavior. For example
CREATE TABLE test1(string1 CHAR(10))
SELECT COUNT(*) FROM tbl1 WHERE string1 = 'acbd'
vs
SELECT COUNT(*) FROM tbl1 WHERE RTRIM(... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
owners of databases
Posted by gv at 11/1/2006 3:00:55 PM
Hi all,
How do I find who owner(Creater) of a database is?
thanks
gv
... more >>
Stored procedure to change not nulls to nulls
Posted by cgeach NO[at]SPAM gmail.com at 11/1/2006 2:24:25 PM
Hello
I have created this code to go through all the tables in my databases,
changing Nullable fields to 'Not null'
-- Drop Procedure DropNulls
-- use ChangeOrders_BESQLSERVERSQL
--Create procedure DropNulls as
set xact_abort OFF
--select 1/0
Declare MyTablesCur Cursor for SELECT [name] F... more >>
Formatting columns in datagrid
Posted by Ellie at 11/1/2006 2:12:12 PM
Hi,
I'm try to have the information that gets put into the datagrid converted to
upper case before it hits the database but I can't find very much (or any)
real help on this. Any information would be very much appreciated.
Thanks,
Ellie
... more >>
Attaching a database in SQL 2005
Posted by Greg at 11/1/2006 2:06:02 PM
USE MASTER
GO
CREATE DATABASE ClaimlineOct ON PRIMARY
(FILENAME='D:\SQL\DATA\ClaimlineOct.mdf')
FOR ATTACH;
GO
When executing this code I get
File activation failure. The physical file name
"D:\SQLData\MSSQL\data\ClaimlineSQL_Log.LDF" may be incorrect.
The log cannot be rebuilt because... more >>
Encryption
Posted by Mary at 11/1/2006 1:50:40 PM
Hi,
I have some information that is stored in the db that needs to protected
(login, ssn...). In my front end application I was looking at using
Cryptography Application Block from Microsoft to encrypt it. Should I just
store encrypted data or maybe the hash? What data type should I use?... more >>
How to convert rows to columns in Select statement
Posted by NaNa at 11/1/2006 1:40:31 PM
Hello All,
I have a table that contains period and value.
eg.
Period Value
1 33
2 67
3 11
4 10
5 21
6 44
7 34
I want to convert to these rows to columns like following
1 2 3 4 5 6 7
33 67 11 10 2... more >>
Blocking on a resource
Posted by ionFreeman NO[at]SPAM gmail.com at 11/1/2006 1:00:41 PM
Help!
My store procedure's taking about 17 minutes to complete. Roughly 3
minutes of that is query cost, the rest is waiting on one resource or
another. I found a delightful little script at
http://www.sqlservercentral.com/forums/shwmessage.aspx?forumid=5&messageid=16430&post=true
that inter... more >>
Date Difference
Posted by RON at 11/1/2006 12:58:57 PM
Suppose I have the 2 dates 27/10/2006 (27th October 2006) & 26/11/2006
(26th November 2006). I want to find out how many days have elapsed
since 27/10/2006 till 26/11/2006 (including 26/11/2006) which is 30
days. The DATEDIFF function only returns the difference w.r.t. the
first parameter specif... more >>
Set default db in Query Analyzer?
Posted by Rick Charnes at 11/1/2006 12:50:25 PM
I don't have access to Enterprise Manager. Is there a configuration
option somewhere so that when I initially connect to a server in Query
Analyzer it starts me up with a default database (other than Master)?... more >>
Clean up sql server cache
Posted by mecn at 11/1/2006 12:04:13 PM
Hi,
I am testing .net app. I restored sql server databases with overwrite the
original database.
I re-launch the .net app, I got this error says. Could not connect to the
database DBID = 15....
After I reboot the sql server, I was able to connect again,.
My question is that how do I fix ... more >>
indexed partitioned view?
Posted by Kyle at 11/1/2006 11:57:15 AM
Running SQL Server 2000 Enterprise Edition.
I've got a 50 million row table with 4 indexes, growing by roughly 250K
rows per day. Performance for the nightly loads into this table is
becoming unacceptable, so I am going to partition this table by month.
A pretty easy and obvious use of partit... more >>
Pass Ampersand in Parameter
Posted by JP at 11/1/2006 11:54:41 AM
I have a parameter in which I need to pass a code that contains an "&"
(ie. 'TI & GT'). What is the syntax for me to correctly do this? I
have tried 'TI & GT' and 'TI & GT' as parameters but get no rows
returned.
Thanks
*** Sent via Developersdex http://www.developersdex.com ***... more >>
using IN when value could be null
Posted by Keith G Hicks at 11/1/2006 11:31:58 AM
I have been using this construct at times:
SELECT ... WHERE CustID NOT IN (SELECT CustID FROM OtherTable)
I hit a problem the other day when I noticed that as in the above example,
CustID is allowed to be NULL in "OtherTable" the above code does not behave
as desired. I noticed that I had in... more >>
set column to NOT NULL not working
Posted by Keith G Hicks at 11/1/2006 11:26:53 AM
sql 2k
table as follows:
CustPhones.PhoneID (PK)
CustPhones.CustID (FK to Custs table) - was previously set to allow nulls
and is a non unique index
I tried to do this:
ALTER TABLE CustPhones ALTER COLUMN CustID INT NOT NULL
and got this error:
Server: Msg 5074, Level 16, State 8... more >>
Merging very big tables
Posted by bill at 11/1/2006 11:19:13 AM
I have noticed while copying data from a table ( on local box) to another
table ( remote box) first SQL Server copies the records to tempdb ( local
box) then starts transferring them to remote box.
insert into [SERVER1].DB1.dbo.BIG_TABLE select * from BIG_TABLE
This operation is fine for... more >>
cascade delete question
Posted by Keith G Hicks at 11/1/2006 10:36:55 AM
I have 2 tables and a FK between them that does not include cascade delete.
If I want to change it to cascade delete via QA, do I have to drop the
constraint and recreate it or is there a way to add cascade delete without
doing that?
Keith
... more >>
Carriage Returns and Line Feeds in Sql Server Tables
Posted by channa at 11/1/2006 10:16:01 AM
So I got a Sql Server database that has been created from a MySql
database, although I don't know how the data looked in MySql when I
started doing some query analysis on the tables I found that there were
'hidden' Carriage Returns {CR} and Line feeds {LF} in each field. So
basically some charac... more >>
Stored Procedure Help (Urgent)
Posted by btcarver at 11/1/2006 9:58:33 AM
Hello, I am working on a web service for retreving news updates and
need some help with a stored procedure.
I have 3 tables
1. tblstory ( to hold the news article, headline, date etc)
fldstoryID (PK)
fldheadline
fldstory
flddate
fldtype
2. tblsymbol ( to hold stock symbol, company nam... more >>
Backup Maint plan and multi-file backup
Posted by Tigermikefl at 11/1/2006 8:37:02 AM
Hey all,
SQL 2000. I like the GUI for Maint plans but I would like to start breaking
up my backup file into 3-4 files. I didn't see anyway to Gui specify
multi-file with dynamic naming of the files.
I tested the multi-file bak in T-sql, see some good performance gain and
ease of moving... more >>
Execute sql job from t-sql
Posted by UnglueD at 11/1/2006 7:59:39 AM
Hello.
I was wondering if it were possible to call a sql job that I have
scheduled dynamically. For example the job would be scheduled to run
every night, however if something happens I would like for the job to
be called right then as well. If this is possible what is the t-sql
syntax fo... more >>
Data not showing
Posted by Jaco at 11/1/2006 7:53:02 AM
Hi,
When I run this update and view the table in Enterprise Manager the column
appears blank but when I view it in QA I can see the update.
The column is Varchar 4000.
Can anyone shed some light please?
---------------------------------------------
Update Configuretext
Set ConfiguredNa... more >>
finding dependencies with sp_depends.
Posted by Chris at 11/1/2006 6:53:02 AM
Hi,
I've written a script, please see below.
The problem is that I get the following output after it is executed.
In the current database, the specified object is referenced by the following:
Table Dropped: table1
In the current database, the specified object is referenced by the followin... more >>
SELECT...INTO to Linked Server
Posted by Peter Hyssett at 11/1/2006 6:45:01 AM
Hi.
In Query Analyser, I tried to run the following:
SELECT * INTO [Linked.Server.05,1234].[destdb].[dbo].[tblname]
FROM [dbo].[sourcetable]
This gave the following error message:
Server: Msg 117, Level 15, State 1, Line 2
The object name 'Linked.Server.05,1234.destdb.dbo.' contains ... more >>
Identity Block Reserved for Inserts - Are you good?
Posted by Rob at 11/1/2006 6:35:01 AM
Hi all,
I have a bit of a complicated question, hope we have an SQL guru out there
that can help us solve this killer problem.
Due to the size of SQL Database we have (largest in the US), we try to
pre-process large data files in IO until we are ready to insert directly into
the database... more >>
Scripting Jobs
Posted by Ste at 11/1/2006 3:35:01 AM
When I use enterpirse manager to script a job, sometimes (but not always) the
calls to sp_add_jobstep appear in the wrong order, with sp_add_jobstep
@step_id = 2 appearing before @step_id = 1 causing the script to fail.
Why is this happening? Is there any way to prevent it?
Thanks
St... more >>
When to use views.
Posted by Archana at 11/1/2006 2:42:33 AM
Hi all,
can anyone tell me when to use views.
thanks in advance.
... more >>
SQL Server 2005 View Problem
Posted by Amjad at 11/1/2006 2:34:02 AM
I have view like
SELECT OrderDate, first_date, CASE WHEN month(OrderDate) < 4 THEN
CONVERT(varchar, year(OrderDate)
- 1) + '/' + CONVERT(varchar, year(OrderDate)) ELSE
CONVERT(varchar, year(OrderDate)) + '/' + CONVERT(varchar, year(OrderDate) +
1)
... more >>
getting nonnull value at top
Posted by Archana at 11/1/2006 2:32:36 AM
hi all,
I want to write query which is ordering data according to non null
value.
Say suppose i have table table1 with columns as id, col1,col2,col3 and
say i have records like
id, col1, col2, col3
1 aa null null
1 null bb cc
1 cc cc cc
1 dd ee null.
... more >>
Search database for field containing value
Posted by planetmatt at 11/1/2006 1:00:35 AM
Im trying to find the table and field containing some data in a large
database and was wondering if it is possible to search the whole
database, all table, all fields and return the tables and fields that
contain a know attribute value. I can see from using the application
the value of the data... more >>
Help with SELECT TOP PERCENT.
Posted by Damon at 11/1/2006 12:00:00 AM
Hi,
I have the following SP:-
@cleaning_team as varchar(1),
@team as varchar(1),
@sub_team as tinyint,
@top as int
AS
SELECT TOP 10 PERCENT dbo.vw_supervisor_inspection_jetspray_pre_post.*,
CLEANING_TEAM_PRE, TEAM_PRE, SUB_TEAM_PRE, CLEANING_TEAM_POST,
T... more >>
Are these the same query?
Posted by Stefan Olofsson at 11/1/2006 12:00:00 AM
Hi all
I am optimizing some queries and got a little confuced...
Can I rewrite the union-query to the one at the bottom?
-- The Union query
select *
from Table1 T1,
Table1 T2
where T1.Column1 = 'xxx' and
T1.Column2 in ('yyy') and
T2.Column1 = 'zzz' and... more >>
Combined Key defination
Posted by Blaze at 11/1/2006 12:00:00 AM
I'm sorry kids I'm not sure how to even start this message. I'm taking a
Access class at college and was needing to look up some terminologies and ran
into this site. OH MY GOD!!!! You guys sit around a chit chat about the
most unusal things, most of the time in a language I don't even truly
... more >>
|