all groups > sql server programming > march 2007 > threads for friday march 16
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
how to prevent a self recursing trigger
Posted by Roel at 3/16/2007 11:55:07 PM
Hi,
I need the functionality to update a column in multiple rows in a table
based on the update of one of those rows in the same column.
E.g. a column 'status'. When the value of row 1 changes to 'accepted', the
value of the column 'status' in row 2 should change to 'accepted' too.
I've wri... more >>
insert (transact-sql) into table with single identity column
Posted by pagerintas pritupimas at 3/16/2007 11:25:03 PM
there is a table with single identity column. how do i insert a new row?
INSERT INTO SomeTable (Id) VALUES (); - ???
... more >>
Help with updating with sorted data
Posted by cps123 NO[at]SPAM gmail.com at 3/16/2007 11:12:54 PM
Hi!
I need to UPDATE one column in a table to reorder data alphabetically
using the field name 'name' as follows:
Today, my table it's organized like this:
ID Attribute Name
296 3927 Carl Hall
297 3927 Luisa Money
298 3927 Marco Casal
299 3927 Sheera Bader
300 3927 Ther... more >>
Query question
Posted by Jack at 3/16/2007 6:01:39 PM
Hello,
I am importing data from a backend system (FoxPro thing from OakStreet.) I
am trying to find records that appear in one table, but not the other. I
can do equijoins, but when I try to do these kinds of queries with multiple
fields, I get screwed up.
..
I keep looking at this thing ... more >>
Dynamically generating code for stored procs
Posted by RSH at 3/16/2007 4:56:31 PM
Hi,
I want to generate a simple SQL Script that will generate the parameters
used to create a stored procedure on the fly.
The code below is for part one...the variable declarations. If I put a
simple print statement in the cursor everything prints fine...but when I try
to concatenate the... more >>
Deleted row information cannot be accessed through the row
Posted by Hang at 3/16/2007 4:31:59 PM
Hi,
I got following exception when accessing database using release version of
my C# application:
System.Data.DeletedRowInaccessibleException: Deleted row information cannot
be accessed through the row.
at System.Data.DataRow.GetDefaultRecord()
at System.Data.DataRow.get_Item(String co... more >>
query
Posted by Aleks at 3/16/2007 4:18:18 PM
Hi,
I have a simple select like
Select ID from table
it returns something like:
1
2
3
4
I need it to return something like
Select ID as groupid from table
where the result is
groupid
1,2,3,4
Does this makes sense ?
Aleks
... more >>
Avg issue
Posted by Andre at 3/16/2007 2:52:35 PM
SQL 2k, sp 4
I'm having some issues with the AVG function and I'm wondering if I'm doing
something wrong. I have a table that has values that I'm trying to average.
So far, nothing too difficult. When I run the query, "select avg(fieldname)
from table" I get this result - 4.20227081581160... more >>
Don't see what you're looking for? Search DevelopmentNow.com.
What a strange result
Posted by Pat at 3/16/2007 1:47:32 PM
Hi Freinds,
I ran this statment by accident and amazingly I got results back
Select Count(*) Pat
what is this statmetn and why is it executing ?
Thanks in advance,
Pat
... more >>
datetime help
Posted by rodchar at 3/16/2007 12:50:15 PM
hey all,
i'm writing a query to get all records between 2 particular dates. the
problem i'm having is that one of the records has the correct date but the
time difference is causing it to fall out of range. can someone please tell
me how i avoid and/or correct this issue?
thanks,
rodchar... more >>
Stored Procedure results to a text file
Posted by mossyoak0270 at 3/16/2007 12:48:08 PM
I need some help - Can anyone tell me how to take the results from the
following stored procedure and write them to a text file automatically?
create proc p_ExtractResults
as
select
cast('1' as char(4)) +
cast(NameKeyPK as char(10)) +
... more >>
Stored Procedure Results to a Text File
Posted by mossyoak0270 at 3/16/2007 12:41:00 PM
I am going to write a Stored Procedure to handle the following Select
statement. What I am not sure how to do is take the results and write them
to a text file. Can anyone help. Fairly new to stored procs.
create proc p_DataExtract()
as
SELECT CAST('1' AS char(4)) + CAST(NameKe... more >>
data type issue
Posted by Mark Schindler at 3/16/2007 12:00:57 PM
Hello
I'm updating DB from the website. I'm using a simple SP to update hours in
the DB. Hours is smallint type, I'm getting an error:
Error converting data type nvarchar to smallint
Here is the SP:
CREATE PROCEDURE DBUpdate_Hrs
(
@emp_id Varchar( 100 ),
@emp_hrs smallint,
@emp... more >>
returns matches otherwise defaults.
Posted by jobs at 3/16/2007 11:21:04 AM
This must be a classic challenge...
two tables
History
k1
k2
kdate
status
Detail
( k1
k2) unique key
descr
History has many repeating rows but may not have a row for every k1/k2
combination.
I need to return
descr,k1,k2, laststatus
(based on kdate r... more >>
Too much business logic in stored proc?
Posted by Ronald S. Cook at 3/16/2007 11:12:25 AM
If stored procedures are supposed be be just data actions (select, insert,
update, delete) and not containing any business logic, how would you handle
when passing username and password to User table and wanting to get a 1 back
if exists and a 0 back if not exists?
Would I have a proc named... more >>
Best way to coalesce this set?
Posted by Ed Ardzinski at 3/16/2007 10:59:23 AM
I have a table with the following fields:
case_id, cause, location, nature
There can be multiple entries for a given case_id, with any range of
duplications in the other 3 fields.
I want to create a set that has each case_id only appearing once, and for
each of the other 3 fields concat... more >>
SQL Trigger Syntax for a type of ELSE Statement
Posted by Claudia at 3/16/2007 10:56:05 AM
I want to update the value to 0 (zero) if the BackEnd_ID does not exist.
DECLARE @A as int
DECLARE @B AS int
SET @B = (SELECT FrontEnd_ID from inserted)
SET @A = (Select BackEnd_ID from MyDb.dbo.MyTable AS C Where C.FrontEnd_ID =
@B)
Update MyTable
SET BackEnd_ID = @A
WHERE FrontEnd_ID =... more >>
reality check
Posted by rodchar at 3/16/2007 10:31:08 AM
hey all,
i have a user-defined function that is using the IF EXISTS(). The SELECT
statement inside that Exists function returns a null. But, it's falling thru
as it does exists.
I thought if the statement returns a null then that means it doesn't exist.
Am I using the EXISTS() in the wron... more >>
How to Update multiple cells based on value in 1 cell....
Posted by Mrpush at 3/16/2007 10:15:00 AM
Hi,
Having a little trouble.
I need to be able to filter records from a table based on the same criteria
such as a record ID. This would show me all records with the same record ID.
I then need to look at every value in certain columns, and if a "1" exists,
I need to change all th... more >>
how to read system tables in sql2005?
Posted by === Steve L === at 3/16/2007 10:07:26 AM
in sql2k, you can read system table directly in EM, but i found they
are all disabled in sql 2005 ssms. so how can a DBA to read system
tables? thank you.
... more >>
Putting out of order item first in ORDER BY
Posted by erdos at 3/16/2007 9:46:44 AM
I have a table with these varchar(10) entries:
a
b
c
m
l
r
p
and want do an order by asc but have "r" be the first item. How is
that query structured? Thanks.
... more >>
SQL Conundrum
Posted by dan_williams NO[at]SPAM newcross-nursing.com at 3/16/2007 8:44:37 AM
I have the following SQL schema
Bookings
-------------
BookID
Hours
BookingStatus
---------------------
BookStatusID
BookingId
StatusID
UserId
Date
Statues
-----------
StatusID
Statuses included Created, Covered, Cancelled, Not Covered, To Be
Arranged, etc.
The BookingSt... more >>
Is there ways to run DTS from a store procedure?
Posted by slimleh at 3/16/2007 7:25:21 AM
Hi,
Can I know is there a way to call a DTS from a store procedure?
If so can someone provide a sample code?
Thanks
... more >>
Using data cache in sql 2005
Posted by Remo at 3/16/2007 7:07:18 AM
Hi All,
Can anyone please help me by provoding information about datacacheing in sql
server 2005.How to cache, update and access kinda things....
Thanks in advance,
Remo
... more >>
Update date/time in all the tables in DB
Posted by Sehboo at 3/16/2007 6:54:16 AM
I have about 100+ tables in my DB, and lot of them have date/time
fields. I have to update all these fields. I just need to add 5
hours to all the datetime fileds (to make them UTC time, instead of
local). I am on SQL Server 2000.
Is there any easy solution for this, or will I have to writ... more >>
Databases List
Posted by lilysdream NO[at]SPAM gmail.com at 3/16/2007 3:59:30 AM
Hi all !
i would know if there is a query to have a list of SQL Database in one
instance.
Thanks a lot by advance ! ^^
Ju
... more >>
Automatically track object (stored procedure) usage?
Posted by DC at 3/16/2007 3:39:57 AM
Hi,
SQL Server 2000: I would like to automatically track the last time an
object (especially stored procedures) have been used so I can find out
which are candidates for deletion. Is it possible to somehow hook into
SQL Server and get this done?
Regards
DC
... more >>
SQL dynamique table name and column name as variable - Problem
Posted by ina at 3/16/2007 3:31:44 AM
Hello guys,
I have a question. Is it possible to pass the table name and column
name as variables like this :
DECLARE @table sysname
DECLARE @tableID int
DECLARE @COLNAME varchar (200)
SET @tableID = 196532963
SET @table = dbo.UDF_TABLE_NAME (@tableID)
SELECT @COLNAME = dbo.udf_sel... more >>
Synonyms for Stored Procedures
Posted by davinder.kainth NO[at]SPAM gmail.com at 3/16/2007 3:21:07 AM
Hi,
I am having a few problems with synonyms! I am using SQL Server 2005
and have a couple of databases setup. One of these databases accesses
a number of tables and views from the 2nd database. To gain access to
various tables in my 2nd database I using synonyms created in the 1st
database (... more >>
trimming strings
Posted by Neil at 3/16/2007 2:04:32 AM
I am trying to create a report in Microsoft SMS 2003 that displays the
system name and operating system type e.g. "Microsoft Windows Server
2003 R2 Enterprise Edition - hostname". I can get the name ok but have
a problem the OS type. The following sql returns
Microsoft Windows Server 2003 ... more >>
error in SQL 2000
Posted by Haytham at 3/16/2007 1:14:52 AM
Dear all,
I'm encountering this error in SQL2000, perhaps you can help me solve it out:
"unable to install or run the application. the application requires that assembly microsoft.sqplserver.connectioninfo version 9.0.242.0 be installed in the Global Assembly Cache (GAC) first"
Thanks,
Egg... more >>
@@identity ,Scope_identity() fails
Posted by Ramesh Subramaniyan at 3/16/2007 12:25:08 AM
hi all ,
SELECT SCOPE_IDENTITY()
SELECT @@IDENTITY
IDENT_CURRENT('Table_Name')
some times SCOPE_IDENTITY(), @@IDENTITY fails to retrieve the
last inserted value , same time IDENT_CURRENT('Table_Name') retrieve the
last inserted value , in... more >>
Advice needed: Bigint (identities) - Am i overdoing it?
Posted by Lim Siew Yin at 3/16/2007 12:00:00 AM
Hi ppl,
Its me again. Sorry for sending so much noobie questions but since we're
scraping the previous project and redoing it all over... i wanted to make
sure we do it right this time round.
k... Using bigint identities is soooooo convenient (instant primary key)
that i am worried we're... more >>
User id in database call
Posted by Johan Karlsson at 3/16/2007 12:00:00 AM
Hi!
We have a system where all authentication is handled in the Business Tier.
The database doesn't really know who's calling except that it is a certain
winservice and whatever user it's running under. Is there anyway to attach
somekind of metadata along with the db-call that could be read... more >>
update same SP in all database (in one sql server)
Posted by Agnes at 3/16/2007 12:00:00 AM
My sql server ont over 50 Database, and they got one standard and samme
Store Procedure
Now, I need to update this SP.
for my old method. I place the SP content into SQL analyzer and choose each
Database and then press "run"
For 50 databases , I need to choose 50 times and press 50 times.
... more >>
Advice needed: Transaction Log .. how far to bring it
Posted by Lim Siew Yin at 3/16/2007 12:00:00 AM
Hi ppl,
Regarding the subject, would appreciate your input/feedback. Thanks.
Senario:
Database contains tables to keep info on Purchasing, Sales, Customers, etc
(normal stuff)
Am hoping to use a Transaction Log as a huge reference table where I can
quickly retrieve all relevant document... more >>
|