all groups > sql server programming > november 2006 > threads for monday november 20
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
Instead Of trigger does not fire over linked server
Posted by Elrick at 11/20/2006 11:54:02 PM
Hi
We created a view on two tables and then created a Instead Of Insert trigger
on the view. Inserting into the view on the local server works correctly and
the trigger fires. However, if we attempt an insert into the view across a
linked server, it appears as though the trigger does not fi... more >>
Using functions in SQL server
Posted by aryaabraham at 11/20/2006 9:22:01 PM
I have a simple 2 table database that I access from VBA in Excel 2003. One
table has an OwnerId as well as a ReporterId which refers to a UserId in the
second table. In addition to the UserId, the second table has user
permissions and a VisibleName.
I would like to write a query that will ... more >>
Default Table Owner using CREATE TABLE, INSERT, SELECT & DROP TABLE
Posted by Peter Nurse at 11/20/2006 9:16:32 PM
For reasons that are not relevant (though I explain them below *), I
want, for all my users whatever privelige level, an SP which creates
and inserts into a temporary table and then another SP which reads and
drops the same temporary table.
My users are not able to create dbo tables (eg dbo.tb... more >>
How can I achieve this
Posted by Chris at 11/20/2006 9:08:03 PM
Hi,
I am selecting data from one column (COL2) and would like to insert it
display it as
COL1 COL2
1 A
2 B
3 C
COL2 is the column selected but I want COL1 to dispnay as incremented.... more >>
Subquery Error in VB.NET 2005
Posted by ruben NO[at]SPAM hmstrategies.com at 11/20/2006 7:37:23 PM
HI!
I'm using something like query in vb.net 2005 connected to SQL Server
2000:
Select field1, field2
from (select subField1 as field1, subField2 as field2 from table1)
and I can't run this query from vb.net using a dataset, this query
works fine in sql server, but, when I execute this q... more >>
Problem with keyword ROOT in a FOR XML query
Posted by BBM at 11/20/2006 6:45:01 PM
Hi,
I would like to output the contents of a table to an XML document. I have a
book that says that the ROOT keyword will tell SQL 2005 to make a well formed
XML document. My SQL statement looks like this...
Select * from Table1
FOR XML AUTO, ELEMENTS, ROOT('XMLTable1')
... more >>
inserting to temp table
Posted by Keith G Hicks at 11/20/2006 6:07:09 PM
SQL 2k.
Given the following:
CREATE TABLE Customers (GroupingNum INT, CustomerName VARCHAR(50))
INSERT INTO Customers (GroupingNum, CustomerName) VALUES (0, 'Customer
Name') -- this is a row of column headers
ALTER TABLE Customers ADD ID [int] IDENTITY (1, 1) NOT NULL -- for the sake
o... more >>
Generate Script in 05
Posted by Ed at 11/20/2006 4:28:01 PM
Hi,
How come I can't find something similar to SQL 2000 in a table --> All
Task --> Generate SQL Script in 05? I want to generate a script for a table
but I remember in 2000, there are so many options like Scripting the Indexes,
Foreign Keys, etc along with the table. where are all those ... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
Require a single Sql Statement for a multiple choice of input parameters
Posted by cisco.kidicantec NO[at]SPAM googlemail.com at 11/20/2006 4:15:48 PM
Hi all - I am trying to search my sequel server sql database
depending on the values selected in drop down combo boxes and text
input into a web based text boxes. I would like to define a single sql
statement which will search the database whether all of the parameters
or only some of the input ... more >>
How to improve performance of DELETE command for many records?
Posted by Hans-Jürgen Arbogast at 11/20/2006 4:03:26 PM
Hello,
I have the following scenario: two Tables A and B
Table A contains about 4 000 000 records.
Table B contains about 32 000 000 records.
I try to delete all unreferenced records from table B.
(Table A references table B) A.bid -> B.id
Table A and B both have primary keys. Tabl... more >>
text function
Posted by Zuska at 11/20/2006 2:59:02 PM
Hi,
is there any easy function to get me the position of the letter in the text...
something like
select instr ('asdfg','d')
result 3
thanks in advance
Z... more >>
Automatically Stop Job
Posted by jasonl22 NO[at]SPAM yahoo.com at 11/20/2006 1:11:15 PM
How can I stop a SQL Server 2005 job that is hung programmatically? Or
is there an advanced setting. For example, I have a process that
normally runs in 2 hours pulling data from a DB2 data source, and it it
takes more than 4 hours, I have a strong suspicion that it is hung and
would like to a... more >>
Stored Procedure Last Changed Date
Posted by csomberg NO[at]SPAM dwr.com at 11/20/2006 12:54:35 PM
Hi.
I am admist SOX as many are. What I am looking for is NOT the date a
proc was created but the last time it was changed. Any ideas?
I looked and test sysobjects but that didn't work.
Thoughts?
Craig
... more >>
Copy Database Wizard
Posted by at 11/20/2006 11:43:04 AM
I have installed 4 installations on 4 seperate machines of SQL 2005 and
applied service pack 1 for SQL2005. On 2 of these machines, if I use the
copy database wizard, it works fine whether I schedule it or run it imead.
On the other 2 machines, the wizard errors out (both computers) at the
c... more >>
Another Is Blank or Null Question
Posted by Sandy at 11/20/2006 11:39:01 AM
Hello -
I need code to handle the case of Divide by Null or Zero for the following:
SUM(CASE WHEN l.DispositionID = 0
THEN 1.0
ELSE 0.0
END)
/
SUM(CASE WHEN l.LoanTypeID < 3
THEN 1.0
ELSE 0.0
END)
(I saw the previous post regarding null and zero, however I don't understa... more >>
Backup and restore using batch script
Posted by David at 11/20/2006 11:32:01 AM
Hello guys,
I have a unique requirement to take the backup of a database using a BATCH
file. Once the backup is taken, I need to restore it using the same BATCH
file.
Do you know how to write the script for these batch files? Any help would be
greatly appreciated.... more >>
Get top value from each group of sorted query
Posted by Ryan at 11/20/2006 11:27:15 AM
Hello,
I have not seen anything that describes exactly what I am trying to do
(one person's question hit it on the head but had no answer).
I basically have list with many columns. I have sorted this list so
that all ID's are grouped together and so that the first record in each
groupi... more >>
clean field
Posted by JFB at 11/20/2006 10:30:47 AM
Hi All,
I have a note field varchar(1000) containing extra data that I want to strip
out like <div> </div> <strong> </strong>
How can I clean this?
It's an easy way? Any links?
Tks
JFB
... more >>
Get top value from each group of sorted query
Posted by Ryan at 11/20/2006 10:14:18 AM
Hello,
I have not seen anything that describes exactly what I am trying to do
(one person's question hit it on the head but had no answer).
I basically have list with many columns. I have sorted this list so
that all ID's are grouped together and so that the first record in each
groupi... more >>
sp_send_dbmail - Remove "row(s) affected" from query results
Posted by Adam St. Pierre at 11/20/2006 9:20:01 AM
Hello again, everyone!
I'm currently attempting to rebuild some of our old SP's that use
xp_sendmail for SQL Server 2005.
While doing so, i've managed to get them all to work! However, I have a
problem:
Whenever I pass a @query parameter, it always returns the row(s) affected
from th... more >>
export from stored procedure?
Posted by Keith G Hicks at 11/20/2006 8:44:09 AM
SQL 2k
Is it possible to export a temp table to a tab delimited text file from a
stored procedure? I know I can use bcp.exe (which works nicely and seems to
be very fast) but it would be more convenient in my current situation to
export directly from a procedure if it's possible. I tried to us... more >>
About check if it is ip address in the column
Posted by Iter at 11/20/2006 8:06:03 AM
Hii Guys,
I have question about IP address. I have a column containing IP Address,
Domain(ie, aa.aa.com) and other data. Now I want to write a sql statement to
check if it is IPaddress, then do something, otherwise do others. Can
somebody have the easier way to check if it is IP address? Tha... more >>
String or binary data would be truncated - On Delete?!?
Posted by Paul W at 11/20/2006 7:52:18 AM
I'm trying to delete records fromt the following table (activitym1):
thenumber - varchar(50)
number - varchar(60)
type - varchar(60)
datestamp - datetime
operator - varchar(60)
description - varchar(2000)
negdatestamp - datetime
sysmodtime - datetime
sysmodcount - float
sysmoduser - varc... more >>
CASE WHEN...Blank AND NULL
Posted by wnfisba at 11/20/2006 7:52:01 AM
I am trying to CASE a phone number where it might be blank and/or NULL and
this syntax is NOT working.
CASE APPRFEE.phone_pre
WHEN ''
WHEN NULL
THEN ''
ELSE
'(' +
RTRIM(LTRIM(APPRAISR.phone_pre)) +
')' +
RTRIM(LTRIM(APPRAISR.phone))
END AS 'Appraiser''s... more >>
Code Generation
Posted by E at 11/20/2006 7:44:02 AM
I have heard there exist code generators for standard crud like stored
procedures.
Can anyone recommend some good ones I can introduce into a build process?
Most of the stuff being done here is straight forward CRUD processing and
would like to do it through stored proc's.
--
Ed... more >>
How to find data properly
Posted by Diane at 11/20/2006 7:03:02 AM
I have a table with data as follows:
Date Amount Date/Previous Dates Amount
11/18/06 25.00 X
11/15/06 100.00 Y
11/13/06 23.00 Z
In the third column I want to divide the current date's amount ... more >>
Concatenate Ntext column
Posted by Mike at 11/20/2006 5:58:27 AM
How can I concatenate data to a ntext column?
In this case, I do not want to do it in the front end as I am writing the
dataset to an XML file.
select id,name,'<CDATA[[' + customer_page + ']>' from customer
* customer_page is ntext.... more >>
Index Tuning Wizard
Posted by Slayer at 11/20/2006 4:48:01 AM
Can anyone tell me why I keep getting the following error on one particular
database when running the index tunning wizard.
"The workload file does not contain any events or queries that can be tuned
against current database." It works fine againat my other databases but for
this one I have... more >>
sp_lock
Posted by Sammy at 11/20/2006 3:53:01 AM
If I run sp_lock and it shows for a process the tempdb as the database with 0
for objectid and Indid with pag for Type and resource '1:87' and 'X' for
mode and status 'grant'.
How do I figure out what this lock is if there is no objectid No. showing.
Thanks for any help.
Sammy
... more >>
error msg when setting primary field
Posted by Rachel at 11/20/2006 3:39:05 AM
Hi,
Please can you help,. all I want to do is to alter a table so that an
existing field is set as the primary key.
The code is:
ALTER TABLE iras.dbo.USys_tbl_Temp_Site_Output_SQL ALTER COLUMN
Client_Site_ID ADD CONSTRAINT Client_Site_ID_pk PRIMARY KEY;
Can you see anything wrong with ... more >>
precision of division with numeric data type
Posted by Pma_Shane at 11/20/2006 3:16:02 AM
I find that when I divide 2 variables of the numeric data type I loose alot
of precision. When I execute the sql bellow I get 0.33333300000000000000.
Shouldn't the answer have 20 3's behind the decimal? I don't seem to get any
loss of presicion with multiplication for example.
declare @a num... more >>
SQL query to copy Data from One Table to another Table having same names but from different databases
Posted by Apurv at 11/20/2006 3:00:38 AM
Hi friends,
I would like to know about the SP(Stored Procedure) or a SQL Query
which will copy data from:
DB1 -> tbl_alm3 TO DB2 -> tbl_alm3
Table Structures in both the Tables are as follows:
EmployeeID | EmployeeName | Car
----------------------------------------... more >>
|