all groups > sql server programming > august 2005 > threads for wednesday august 10
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
Domain name
Posted by Enric at 8/10/2005 11:59:08 PM
Dear all,
how could I figure out the name of the domain through any statement/function
in Transact-Sql?
Any help or comment would be well appreciate,
... more >>
Cascading path problem
Posted by Jonah Olsson at 8/10/2005 11:45:27 PM
Hello,
The following SQL code produces the famous multiple cascading paths problem.
How should I design the tables to have the below functionality, but keep the
cascading paths? A Doc doesn't necessarily have to be related to a Folder,
but must be related to a Cust.
Changing ON UPDATE to... more >>
Oracle - to - SQL Server syntax questions
Posted by Joe J via SQLMonster.com at 8/10/2005 10:48:05 PM
I am new to SQL Server. What is equivalent to the Oracle 'rollback' ? Is it
Rollback Transaction or Rollback Work? Same question for 'commit'.
TIA... more >>
Help on n - Tier Architecture ?
Posted by Silent Ocean at 8/10/2005 8:13:43 PM
Hi
1. I am in process of designing N-Tier Application using ASP.NET. Can
anyone guide me the right material or microsoft guidelines document
which I can used in designing the N-Tier application.
2. I would also like to know whether to use Web Services or .Net
Remoting in designing N-Tier... more >>
removing embedded duplicate rows
Posted by bday NO[at]SPAM iandd-dot-com.no-spam.invalid at 8/10/2005 7:08:52 PM
I have a table that contains a field with data like
dog
dog
cat
cat
I only what to return one of the values. DISTINCT doesn't do it. An
suggestions
Thanks
Bo
... more >>
Trigger Help!
Posted by Arpan at 8/10/2005 5:59:38 PM
I want to update the Password column in a table using the following
UPDATE query:
----------------------------------------
UPDATE tblUsers SET Password='<whatever is the new password>' WHERE
UserID='<whatever is the UserID>' AND Password='<whatever is the old
password>'
---------------------... more >>
Transactions for read-only queries
Posted by jxstern at 8/10/2005 5:10:13 PM
I have a complex SP using many temp tables, many complex inline table
value UDFs. Base version runs in about one minute.
If I put a "begin transaction" at the start and commit at the end,
this version runs in about twenty seconds.
The reports from SHOW STATISTICS IO show some differences, b... more >>
backup table
Posted by mickeyg at 8/10/2005 5:02:01 PM
I am new to SQL Server. I need to back up a single table through a Query
Analyser. Whoe can I do that? I was trying to find how to do it on google
but could not find the solution. Any link will be helpfull.
Thanks in advance
... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Tricky syntax problem with sp_ExecuteSQL
Posted by Sylvia at 8/10/2005 4:50:14 PM
Hello all,
I was psyched to get the below to work - basically calling a delete on
a remote server via sp_executesql. It was a huge performance gain over
doing the delete via 4 part naming.
DECLARE @TimeIDStart int
, @TimeIDEnd int
, @ServerName varchar(15)
SELECT @TimeIDStart = 2... more >>
Stored Procedure Output
Posted by Mark at 8/10/2005 4:15:04 PM
Hello,
Can anyone help me on how to take the resultset from a stored procedure and
insert it into a table?
Any help would be greatly appreciated!
Thanks in advance.... more >>
Cannot insert the value NULL into column 'USERDEF1'
Posted by Jeff Metcalf at 8/10/2005 3:59:02 PM
The statement:
update svc00200
set userdef1=
(SELECT svc00210.userid
FROM dbo.SVC00210
where svc00200.callnbr=svc00210.callnbr and svc00210.frmstat='' and
svc00210.tostat='10E')
The error:
Server: Msg 515, Level 16, State 2, Line 1
Cannot insert the value NULL into column 'USERDEF1', t... more >>
Case sensitive problem
Posted by Ming at 8/10/2005 3:26:03 PM
Hi,
I'm working on a SQL 2000 server that was not set up by me. I tried creating
stored procedure on it and found all variables are case-sensitive. How do I
change it to case insensitive?
For example, if I use QueryAnalyzer and enter in the following two lines:
DECLARE @VAR1 int
SET @var... more >>
An aggregate function for most/last frequent?
Posted by Arthur Dent at 8/10/2005 3:10:26 PM
Is there any function to do something like:
SELECT MOSTFREQUENT(MyCol) FROM MyTable
so that if MyCol had the vals:
'A'
'A'
'B'
'A'
'C'
'C'
'B'
'A'
the result would be 'A'
as opposed to having to do something (roughly) like:
SELECT MyCol FROM MyTable WHERE MyCol =
(SELECT MyCo... more >>
What I can do? SELECT command
Posted by OKLover at 8/10/2005 3:05:01 PM
SELECT @SQLcmd = 'UPDATE MyTable SET col1 = REPLACE(formula, 'f', '') WHERE
formula IS NOT Null'
EXEC (@SQLcmd)
It reports the syntax error about ' ??????... more >>
TSQL question
Posted by Richard Thayne at 8/10/2005 2:20:14 PM
I don't know if there is a better place to put this questions, but I have a
T-SQL question. I am looking at a stored procedure that has 'Select
Distinct 0' in the select statement. What is the "Distinct 0" used for?
Can anyone direct me to the answer? Thanks,
... more >>
Microsoft Responds To Serious Credibility Issues...
Posted by clintonG at 8/10/2005 2:14:21 PM
I think Microsoft really deserves credit for responding to questions
regarding the company's ability to produce secure and robust versions of SQL
Server 2005 and Visual Studio 2005.
Microsoft's representatives respond [1].
<%= Clinton Gallagher
METROmilwaukee (sm) "A Regional Inf... more >>
Close cursor in another procedure
Posted by Tod at 8/10/2005 2:05:58 PM
Hi,
I declared a cursor in an Insert trigger. In this trigger I called a sp. Can
I close this cursor in the sp?
----------------------------------------------------------
CREATE TRIGGER MY_TRIGGER ON dbo.MY_TABLE FOR INSERT
....
DECLARE MyCursor CURSOR LOCAL FAST_FORWARD FOR SELECT MyField F... more >>
SQL Profiler / TextData
Posted by mikeb at 8/10/2005 2:01:22 PM
Is there any way to have the sql profiler not truncate the TextData values ?
It seems to be truncating to about 100 chars.
Or, is there another tool that I could use to trace the sql statements our
app is requesting from the database as its running?
... more >>
Stored procedure -> SqlDataAdapter: Visual Studio 2003 bug?
Posted by ASP.Net programmer at 8/10/2005 1:58:50 PM
Hi,
I have created a Stored procedure which has two arguments. This is the
begin of the stored procedure:
....
ALTER PROCEDURE usp_name
@age tinyint = 42,
@date datetime = NULL
AS
IF @date IS NULL
BEGIN
SET @date = GETDATE()
END
SELECT date,
....
This stored procedure... more >>
Column Query with a Variable
Posted by Keith at 8/10/2005 1:29:03 PM
I have 30 fields in a table called ADP_Pay_Detail that I need to query with
the exact same query. Each field is named DED_CD_1, DED_CD_2, etc. up to
DED_CD_30. I have coded a counter with a WHILE statement to increment the
last number of this string, and assign the entire string to a varchar... more >>
Duplicating Record
Posted by Emma at 8/10/2005 1:09:05 PM
How can I duplicate a record in a table, but only change a key field to make
it unique? For example, I have a table called CustomerInfo with about 50
fields and one of the fields is called CUSTID. I want to duplicate one record
with CUSTID 75 in the table but change the CUSTID in the new recor... more >>
change HH from 24 hrs to 12 hrs
Posted by LP at 8/10/2005 12:56:04 PM
I have a time value that I want to display in 12 hours instead of 24
hours(military time)
DATEPART(HH,@ACTTIME)
How do I get 1 - 12 and instead of 0-23?
... more >>
VisualStudio requirments for SQL Server Reporting Services
Posted by Doug at 8/10/2005 12:56:01 PM
Hi,
I am investigating Reporting Services and wouldlike to develop some reports
in Report Designer. Visual Studio 2003 is such a pigfor hard drive space I
only want to install the minimum requirments. What do I need to install to
be able to use Report Designer to develop reports for RS?
... more >>
Query using two column names in a table (to find rows near each other)
Posted by C-W at 8/10/2005 12:54:59 PM
I have a table called Seats in my database...
CREATE TABLE [dbo].[Seats] (
[SeatSerialNo] [int] IDENTITY (1, 1) NOT NULL ,
[VehicleSerialNo] [int] NOT NULL ,
[RowNo] [smallint] NOT NULL ,
[ColumnNo] [smallint] NOT NULL ,
[SeatNo] [varchar] (5) COLLATE SQL_Latin1_General_CP1_CI_AS NU... more >>
Why is this Inserted Scan and Deleted Scan so costly in a trigger?
Posted by Todd Beaulieu at 8/10/2005 12:49:14 PM
Does anyone know why accessing the inserted and deleted tables in a trigger
would involve a lot of I/O for a single row update? I have other triggers
with exceedingly low costs for accessing the Inserted and Deleted tables,
but this one is through the roof, at 24. I'm doing a single-row update. I... more >>
Batch-mode SMTP automation
Posted by NewDBAGuy at 8/10/2005 12:48:03 PM
We have a couple of SQL boxes (2000 Std Ed SP3 on Win2k3 SP1) and want to use
email connectivity to send form emails to users, broken down by specific
results from a query. Ex: for each salesperson's sale, list all pending
accounts
Our email system is GroupWise, and it supports SMTP. We wil... more >>
Sched Job History Query
Posted by Mark at 8/10/2005 12:35:11 PM
Hello,
I need to write a query that displays all sql scheduled jobs with respective
information (same as when selecting the 'jobs' node under the sql server
agent). Can anyone help me on the query or just the table that displays the
needed information?
Any help would be greatly apprecia... more >>
Stored procedure: GETDATE
Posted by ASP.Net programmer at 8/10/2005 12:26:22 PM
Hi,
I can't get the stored procedure displayed below to work. It parses
correctly and if I supply a date it works as well. It doesn't work when I
ommit the date from the calling code.
I have read and tried quite a few websites about this problem, but
converting it to CHAR, then convert i... more >>
Select GetDate()
Posted by Ivan Debono at 8/10/2005 12:26:07 PM
Hi all,
I'm using the profiler to check which statements get executed. Well, I
noticed that before each of my statements are executed, SQL Server makes a
Select GetDate()... every time!!
Is this necessary or can it be avoided? If it can, how?
Thanks,
Ivan
... more >>
Query help needed
Posted by Tom Friend at 8/10/2005 11:56:49 AM
Problem:
3 tables, one contains students, next contains classes, third contains links
between the first two (index values) plus some grading stuff. I need a query
to populate a checkbox list.
I need each row to be unique and must contain student.name, student.index,
and a boolean indicating... more >>
Primary key vs Clustered Index with respect to Replication.
Posted by Rajesh at 8/10/2005 11:49:03 AM
Is the following statement is TRUE.
Primary Key will allow tables to participate in replication
whereas Clustered Index will not allow tables to participate in replication.
I want to double check the above statement is valid
I created two tables with primary and clustered key.
create tab... more >>
Task without cursors
Posted by simon at 8/10/2005 10:41:22 AM
Can someone help me with this.
I have stock and when new order came, I must find appropriate items in stock
and reserve them for export.
(each the same item can be in different places in stock with different
properties)
I don't know how to accomplish this task without cursors.
I created ... more >>
Query question
Posted by Jack at 8/10/2005 10:25:19 AM
Hello all,
Given the scenario below, I am trying to 'flatten' a result set. ( I think
'flatten' is the right metaphor) I am trying to get to the most distinct
record for a particular category set.
Thanks for your time (as always)
CREATE TABLE [dbo].[CategoryList] (
[row_id] [int] NULL ,... more >>
Someway for UDF to return a boolean TRUE/FALSE value ??
Posted by frostbb at 8/10/2005 10:03:02 AM
Greetings,
I'm new to SqlServer 2000 and I'm trying to develop a set of tools that will
help with our stored procedure rewrites when moving from our Unix based DB.
Question:
Is it possible to define a User-Defined Function that returns a Boolean
value ??? Like below ???
CREATE FUNCT... more >>
Peformance Question
Posted by Yosh at 8/10/2005 9:31:37 AM
Which query performs better (if one does)
DELETE ColumnA FROM TableA WHERE ColumnA IN (SELECT ColumnA FROM TableB)
or
DELETE TableA
FROM TableA, TableB
WHERE TableA.ColumnA =3D TableB.ColumnA
I hope this makes sense.
Thanks,
Yosh... more >>
Insert into table help
Posted by Lontae Jones at 8/10/2005 9:21:03 AM
How can I Do an insert into a table with null constraints
Insert Test1 (TestColumn)
Select Testentry from Test2
Cannot insert the value NULL into column 'TestColumn'... more >>
Indexed Views
Posted by Vikram Kamath at 8/10/2005 9:06:32 AM
Hi,
I would like to know how indexing works for indexed views under the
following situation.
I have multiple indexed views which has a common base table. But all the
views have different set of data beacuse of certain join conditions with
other tables.
So what happens when i insert a ... more >>
Quasi-work queue (sanity check)
Posted by Mike Jansen at 8/10/2005 8:39:36 AM
It's just me with another question from the World of the Far-From-Ideal.
All I'm looking for is a sanity check on a quasi-work queue approach. I
will also take comments on good design of work queue tables for future
reference but my main focus is getting a sanity check on the approach that
... more >>
Kalpesh Thaker; Dirty Plagiarizer
Posted by Bud Y. Zer at 8/10/2005 8:20:27 AM
Kalpesh Thaker; Dirty Plagiarizer
http://www.sqlservercentral.com/columnists/sjones/apologiestokenhenderson.asp
... more >>
Expression Too Complex error - mdb
Posted by Steve B. at 8/10/2005 8:05:07 AM
DataAdapter.update(dataSet) exception Error:
"Changes not saved to database. Expression Too Complex"
Using: Visual Studio, C#, ADO.Net interface and MS-Access (OLE DB Jet)
Without diving into the details on the one-to-many 99 column Access (Main)
table , can someone tell me the reason fo... more >>
SQL audit new rows inserted trigger
Posted by georgina.ispirian NO[at]SPAM cazenove.com at 8/10/2005 7:52:59 AM
Hi,
pleeease can someone help?
I need it to audit new rows entered onto a table (Bonus_Scheme) and
then output the details to an audit table.
So far, I can only get the trigger to fire into the audit table, when
an existing row value is edited, rather than if a whole new row is
inserted.... more >>
How to automaticly find and delete orphan users in all db?
Posted by marta at 8/10/2005 7:37:09 AM
Hi
I need help ;)
How to find orphan users in all databases on sql server 2000 and delete
them in one script or in any automated or semi automated way ?
I try do it using sp_MSforeachdb sp_change_users_login 'Report' but i
did't succeded. Probably i'm not experienced enough to complete this
... more >>
Sheshadrinath R
Posted by Sheshadrinath R at 8/10/2005 7:19:13 AM
Hello,
In a table, I want to delete only the duplicated rows retaining the
actual and original row. How can I do this?
Thanks,
Sheshadrinath R... more >>
Linked views
Posted by Craig HB at 8/10/2005 7:15:06 AM
I have a number of databases on the same SQL Server that all use tables from
a database called RestaurantMgr (also on ths server). I have been accessing
these table using linked views (eg. create view Branches as select BranchID,
BranchName from RestaurantMgr..Branches).
Is this the best w... more >>
BCP Syntax
Posted by JLFleming at 8/10/2005 6:36:06 AM
I am trying to use the BCP utility to copy a stored procedure out to a text
file.
1) Is there a way to include the field headers in the text file?
2) Is there a way to turn off the quotes between data?
So far, here is the syntax I have so far:
bcp "database..sp" queryout "c:\test.t... more >>
Optimizer hint for WHERE clause
Posted by Ramon de Klein at 8/10/2005 5:53:52 AM
Suppose I have the following the query inside a trigger (isObjectOwner is a
fairly expensive function to execute):
SELECT TOP 1 @InvalidObject = parent.id
FROM inserted
INNER JOIN parent ON inserted.parent_ref = parent.id
WHERE dbo.isObjectOwner(parent.owner) = 0
This trigger chec... more >>
Firing User defined Function from Select, without using function name, is this possible?
Posted by philip.mckee NO[at]SPAM pramerica.ie at 8/10/2005 4:08:37 AM
Hi all, Can anyone tell me if it is possible to fire a user defined
function in SQL Server directly from an ordinary select function.
Example:
I have a function fx_Str_Title_Case(varchar). (change string to title
case, caps first letter of each word in sentence).
At present I call this as fol... more >>
Find fields with an index
Posted by NeilDJones at 8/10/2005 3:49:06 AM
Hi.
I am trying to find a way to establish whether a field has an index on it or
not. This is relevant because I am writing code to loop through the fields in
a table and shrink columns according to the length of the longest item in
them, and you cannot alter a column that has an index on i... more >>
log files
Posted by Roy Aouad at 8/10/2005 2:43:56 AM
how can i read a the log file of my database .ldf
*** Sent via Developersdex http://www.developersdex.com ***... more >>
CURSOR question
Posted by Mark Hoffy at 8/10/2005 2:21:05 AM
I have written my first stored proc using a cursor and am wondering if I did
it correctly. It does work, but I wanted to make sure I am using it
correctly and that this code is optimized or if there was a simpler way to
do it (maybe without cursors). Basically what I needed to do was loop
thro... more >>
INSERT statement; only 1 column in table.. that too identity
Posted by Rakesh at 8/10/2005 12:22:02 AM
need to write an insert statement to a table with only identity column
without using IDENTITY_INSERT option
create table t (id int identity(1,1) primary key)
Rakesh... more >>
getting list of SQL Instances / Databases on network
Posted by David C via SQLMonster.com at 8/10/2005 12:00:00 AM
I am using C#.NET and I am writing an application where I need to display to
the user in a comboBox all the SQL Server instances that can be detected and
dis. I have seen many applications like Enterprise Manager that can detect
them all. Once the user selects the instance, I would also like to g... more >>
Close cursor in another procedure (part II)
Posted by Tod at 8/10/2005 12:00:00 AM
<I'm sorry for new post but I couldn't reply to group because of errors>
Hi David,
I have a lot of reasons to using cursor and I don't know better way to do
this.
For example;
I control datas in the cursor like this:
----------------------------------------------------------
CREATE TR... more >>
Data Dictionary
Posted by ichor at 8/10/2005 12:00:00 AM
hi what is a data dictionary and can anyone give me an example / sample of
it?
thanks
... more >>
WITH (NOLOCK) in practice, not theory
Posted by Mike Jansen at 8/10/2005 12:00:00 AM
Understanding the theoretical potential for problems with using WITH (NOCK)
or READ UNCOMMITTED, does anyone have any personal experience with using
WITH (NOLOCK) and its downfalls? What types of workloads cause the 601, 605
errors, etc. ?
Thanks,
Mike
... more >>
2005 and Packages?
Posted by Arthur Dent at 8/10/2005 12:00:00 AM
I was just curious, in the new features of SS2K5, is there anything
which will be akin to Oracle's concept of Packages? allowing to
group related code together into a single object?
Thanks in advance,
- Arthur Dent
... more >>
TempDB
Posted by Mike Labosh at 8/10/2005 12:00:00 AM
We're having lots of issues with TempDB swelling up (over 16 gigs) and
running out of disk space.
I am looking for a list of the kinds of things that increase the size of
TempDB, so that we can avoid them.
Thanks in advance!
--
Peace & happy computing,
Mike Labosh, MCSD
"This thor... more >>
Need Help on Outer Joins
Posted by Erdal Akbulut at 8/10/2005 12:00:00 AM
Hello,
I have spent more than enough on this, but stucked.
I have a Monthly Sales summary table, I want to show last year's same
month sales in the same row.
Here is the code
-- FinMM format YYYYMM
--Update Prev Year's Sales
-- Find Last year's sales for customer for it... more >>
ORDER BY parameter
Posted by simon at 8/10/2005 12:00:00 AM
How can I write that SORT depends on parameter, something like:
ORDER BY column1 case when @param=0 then DESC else ASC end
Regards,S
... more >>
|