i have a many to many table relationship that involves 2 logical tables.
Record table that joins to a relation table on primaryID
Second instance of record table that joins to the relation table on ReciprocalID
The purpose of this is to show family relations within the database. Each primary Record table has one or more rows in the rel...
Does T-SQL allow a variable number of arguments to a stored procedure like params in C#?
EDIT: I'm using SQL Server 2005. That 2008 answer makes me wish we were using it...
...
I have a table structure like this:
create table status_master
(
Name varchar(40)
status varchar(10)
)
I need to create trigger for status column if the status column value updated value
FAIL then the trigger invoke one insert commant like:
insert into temp value('s',s's')
Could you please any one give me tha idea to solve this...
how do we execute an Oracle Stored Procedure from SQL Server 2005?
As part of a SQL Server scripts we need to execute an Oracle 10g Stored Procedure and download data to SQL Server 2005
...
Good Afternoon All,
I have two tables in my SQL Server 2005 DB, Main and MSDRGWEIGHTS. I want to create a stored procedure that updates Main.RelWeight with the appropriate value from MSDRGWEIGHTS. I have written the following code as part of the stored procedure:
UPDATE MAIN
left outer join MSDRGWEIGHTS AS W ON MAIN.MSDRG=W.MSDRG
SE...
I have a large table I imported from an Excel spreadsheet. For five of the columns, containing teacher names, I'd like to collapse all of the blanks in each row so I have no blanks to the left of any name. An example would probably show better what I mean.
Here's an example of the data now:
Student ID Teacher1 Teacher2 Teacher3 Tea...
I have 2 SQL Servers:
temp1 XX.13.23.2
temp2 XX.23.45.6
The temp1 server has a database called db1 and contains a procedure called p1.
I want that procedure to insert the value on Temp2 server Database name db2 on table T1.
Is it possible to use procedure to insert value on another server's database?
If this is this possible th...
I'm looking to generate the SQL scripts for table creation programmatically based on class definitions in my DAL similar to SQL Server Management Studio.
So, when I right click on a table in MS SMS, and tell it to script table as > Create to > new query window, it generates some very understandable code. However, I'm not sure why the...
Can you confirm if you have successfully executed an oracle stored procedure from sql server using the open query function. If yes, How? because I am having problems executing stored procedures with arguments using the OPENQUERY Function.
...
Using states as an example, my current data looks like
StateAbbrev | NumOfResults
----------- ------------
MD | 5
VA | 2
DC | 7
MD|VA | 2
CA|NY|VA | 1
I would like it to output the following
StateName | NumOfResults
--------- ------------
Maryland ...
Hello experts,
I have a table as shown below
Q_ID DeptID EmployeeName City
100 100 testest abcd
100 101 tata cdd
with 100K records. I need a query which should fetch all records with same Q_ID but different DEPTID.
Please help.
Thanks
...
When I run this in sql server2005 I got error.
select * from productratedates
where RateDate BETWEEN '31/10/2009' AND '03/11/2009'
Error: The conversion of a char data type to a datetime data type resulted in an out-of-range datetime value.
But When I run this in SQl server 2005. It is perfectly all right.
select * from productrate...
This is an SQL Question, I think it is difficult one - I'm not sure it is possible to achieve in a simple SQL sentence or a stored procedure:
I want to find the number of the longest sequence of the same (known) number in a column in a table:
example:
TABLE:
DATE SALEDITEMS
1/1/09 4
1/2/09 3
1/3/09 3
1/4/09 ...
I have the following
id eventid startdate enddate
1 1 2009-01-03 2009-01-05
1 2 2009-01-05 2009-01-09
1 3 2009-01-12 2009-01-15
How to generate the missing dates pertaining to every eventid?
Edit:
The missing gaps are to be find out based on the eventid's. e.g. for eventid 1 the output should be 1/3/2009,1/4/2009,1/5/2...
I have table in data base name "train delay, with columns
train number(int),
DelayTime(int),
DelayReason(nchar)
so the train may have more than one delaytime for each delay reason, for example:
trainnumber,Delaytime,DelayReason
1 ,5 sec ,x
1 ,10 sec ,Z
1 ,70 sec ,TY
I want to create a crystal rep...
Hi, I just recently learned of the existence of the new "EXCEPT" clause in SQL Server (a bit late, I know...) thru reading code written by a coworker. It truly amazed me!
But then I have some questions regarding its usage: when is it recommended to be employed? Is there a difference, performance-wise, between using it versus a correlate...
We have a website using ASP.NET MVC and SQL Server 2008 and we are using the default transactionscope isolation level which is Serializable. But it makes the application unusable if any transaction is opened as we have a table that being used by almost everything and it runs like
select * from table1 where id = 1
So I think it locks ...
I have a simple table containing Student Numbers and corresponding Teacher Numbers, and I need to denormalize it for input to a legacy system.
For example, here's what the data looks like now:
StudNumber TeacherNumber
445 57315
445 88584
445 95842
858 88115
858 65443
858 57315
858 211...
I have a Where Clause that checks the existence of rows in a subquery, but I only want to execute that check if a bit is set to 1. So for example:
Select * from Listing l
Where
l.IsDeleted=1
AND CASE WHEN @MustHasPicture = 1 THEN
(
EXISTS
(
SELECT NULL AS [EMPTY]
FROM [dbo].[ListingPictures] AS [lp]
INNER JOIN...
I have a table "Events" and a table “Slots” where Slots.SlotID = Events.MainSlot OR Events.ExtraSlot.
I need to sum the number of “Attendees” per time slot (as MainSlot and as ExtraSlot - ExtraSlot is optional)
Table "Events"
ID------Name----------MainSlot-------ExtraSlot-------Attendees
1-------Event1--------1 -------------n/a-----...