|
yeah, id is PK, deptid and Cid are FKs
TVMU^P[[IGIOQHG^JSH`A#@`RFJ\c^JPL>;"[,*/|+&WLEZGc`AFXc!L
%^]*IRXD#@GKCQ`R\^SF_WcHbORY87??6?N8?BcRAV\Z^&SU~%CSWQ@#2
W_AD`EPABIKRDFVS)EVLQK)JKSQXUFYK[M`UKs*$GwU#(QDXBER@CBN%
Rs0~53%eYrd8mt^7Z6]iTF+(EWfJ9zaK-i?TV.C\y<p?jxsg-b$f4ia>
--------------------------------------------------------
128 bit encrypted signature, crack if you can
|
|
|
|
|
Hi All,
Can any one help me out with a tutorial or a sample code on how to call web service from stored procedure.
I need to deploy an application that can do this as fast as possible.
Thanks
|
|
|
|
|
You might be able to do this using CLR Stored Procedures[^].
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
Hi,
I'm trying to send a parameter to a Stored Proc from ASP.NET in the form of a list of values to be used in an IN clause. However, the IN clause is looking up a column of type int, and I am getting a syntax error when I try to execute the SP:
C# code calling SP
<br />
<br />
SqlConnection conn = new SqlConnection(sqlT.getServerConnString("ConnString")); <br />
SqlCommand cmd = new SqlCommand();<br />
cmd.Connection = conn;<br />
cmd.CommandType = CommandType.StoredProcedure;<br />
cmd.CommandText = "SlideShowAppGenProp";<br />
SqlParameter param1 = new SqlParameter();<br />
param1.SqlDbType = SqlDbType.VarChar;<br />
param1.Size = 1500;<br />
param1.Value = strPropRefList;<br />
param1.ParameterName = "@refNumber";<br />
cmd.Parameters.Add(param1);<br />
<br />
In the above code, strPropRefList is a string value in the following format:
"129759, 130009, 130427, 130635, 130646, 131258"
SP code:
<br />
<br />
PROCEDURE SlideShowAppGenProp<br />
<br />
(<br />
@refNumber varchar(1500) <br />
)<br />
<br />
AS<br />
SELECT<br />
<br />
a.ID AS 'refNumber',<br />
c.Description AS 'Area',<br />
d.Description AS 'Region'<br />
<br />
from<br />
tPty_Property a<br />
INNER JOIN tLkp_PropertyGuideDistrict c<br />
ON a.lkpPropertyGuideDistrictID = c.ID<br />
INNER JOIN tLkp_PropertyGuideSection d<br />
ON a.lkpPropertyGuideSectionID = d.ID<br />
<br />
WHERE <br />
a.ID IN (@refNumber)<br />
<br />
ORDER BY<br />
a.ID<br />
<br />
Running the code as it is, I get the following error...
Server: Msg 245, Level 16, State 1, Procedure SlideShowAppGenXml, Line 8
Syntax error converting the varchar value '129759, 130009, 130427, 130635, 130646, 131258' to a column of data type int.
...which is understandable because SQL is treating the whole value as one string, and places single quotes at each end.
I don't want to have to rework my C#/SQL code to make multiple DB calls (the number of reference values in the parameter string can go as high as 50), so is there another way that I can pass this comma-separated list of values into a SQL Stored Proc IN clause?
Apologies if there is a really simple solution and I have missed it.
Thanks,
Stuart
|
|
|
|
|
|
Thank you both for your suggestions
I tried Mark Miller's suggestion, and has done exactly what I needed, many thanks.
|
|
|
|
|
The simplest thing would be to convert the whole thing to dynamic sql and use sp_executesql.
declare @sql nvarchar(500)<br />
set @sql = '<br />
SELECT<br />
a.ID AS 'refNumber',<br />
c.Description AS 'Area',<br />
d.Description AS 'Region'<br />
from<br />
tPty_Property a<br />
INNER JOIN tLkp_PropertyGuideDistrict c<br />
ON a.lkpPropertyGuideDistrictID = c.ID<br />
INNER JOIN tLkp_PropertyGuideSection d<br />
ON a.lkpPropertyGuideSectionID = d.ID<br />
WHERE <br />
a.ID IN (' + @refNumber + ')<br />
ORDER BY<br />
a.ID'<br />
<br />
exec sp_executesql @sql<br />
Having said that, implementing Mark Millers method would be the ideal thing to do.
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|
How to register custom dll into report.rdlc(report viewer)?
and how to custom function in to report.rdlc ?
plz send me reply
Thanks & Regards
Lav Naphade
lav naphade
|
|
|
|
|
lav naphade wrote: How to register custom dll into report.rdlc(report viewer)?
and how to custom function in to report.rdlc ?
Reading the documentation[^] would be a good place to start, no?
Paul Marfleet
"No, his mind is not for rent
To any God or government"
Tom Sawyer - Rush
|
|
|
|
|
hi all
i have 3 tables as employees,medical,expenses
i need to take the information from all these 3 tables for the employees
Table1(employees)
EmployeeID DepartmentID
1 100
3 115
TAble2(medical)
EmployeeID ClinicID
1 7
3 11
4 15
Table3(expenses)
EmployeeID ExpenseID
1 5
3 10
now i should get all the details of the employees which is common in all the 3 tables
my answer should be like this:-
EmployeeID DepartmentID ClinicID ExpenseID
1 100 7 5
3 115 11 10
hw will i write a query to get these details?....
thanks in advance...
|
|
|
|
|
You just want a straightfoward inner join for that.
select a.Id, a.DepartmentId, b.ClinicId, c.ExpenseId from Table1 a join Table2 b on a.EmployeeId = b.EmployeeId join Table3 c on b.EmployeeId = c.EmployeeId
Regards,
Rob Philpott.
|
|
|
|
|
Hi all,
Can anybody knows the diffrence between CTE and Derived table ??
Thanks in advance
Rana Krishnraj
|
|
|
|
|
|
Aloha,
I'm doing a car related website, where I need to fetch 3 cars similar to the one currently viewed by the user.
I would like to fetch 3 cars of different brands, but I can't make it happen
My query looks like this. It returns 3 similar cars, but they might all be from the same brand. How can I change my query, so the 3 cars will be from 3 different brands?
<br />
SELECT brand, model, topspeed, acceleration, hp, ABS(987-hp) AS 'nearest' <br />
FROM cars WHERE hp <> 987 AND cars.type = 'FHC' <br />
AND brand != 'Bugatti'<br />
ORDER BY nearest LIMIT 3;<br />
Thanks, Mads
|
|
|
|
|
What database are you using? Is this going in a stored procedure?
I think you probably need to adopt an approach where do your query for just one car, then union it with a second query the same as the first by with an added condition to make sure the brand is different, and then again for a third time.
Make sense?
Regards,
Rob Philpott.
|
|
|
|
|
Makes sense. It's a good idea, but it's no secret that I would prefer a single query.
I use MySQL, it's a normal SQL string.
|
|
|
|
|
Is there a way grant the right to alter any existing table for the current database to a specific user?
Thanks.
|
|
|
|
|
You could use GRANT ALTER TO [username]. However, that grants alter permission to all objects within the database, including functions, stored procs and views. I tried using ALTER ANY TABLE, but it is not a valid command. So as far as I can tell you need to explicitly grant ALTER permissions for each table and you will need to do it every time you add a new table.
You could write a script which loops through sys.objects and grants ALTER permission on each user table. But other than that there doesn't seem to be a way to do it and you're still stuck adding permissions each time a table is created.
|
|
|
|
|
Mark J. Miller wrote: So as far as I can tell you need to explicitly grant ALTER permissions for each table and you will need to do it every time you add a new table.
I thought so, but I still had some hop left that I could avoid it.
Thanks for the explanation.
|
|
|
|
|
How do I get the second most expensive call from my database. Currently I am using a Max(amount) statement, but as it turns out the dump of data I was given was just that, a dump, and they have put the total of all calls in my data as well. Can anyone give me some script to select the max amount, but the second biggest amount?
Thanks
modified on Thursday, April 3, 2008 3:12 AM
|
|
|
|
|
|
Ok that's great ye, thanks, but how do I get it to NOT display the TOP 1 and only the Second one?
|
|
|
|
|
Try something like this:
declare @max int<br />
<br />
-- get the maximum value<br />
select @max = max(call) from table<br />
<br />
-- get the highest value below the maximum<br />
select top 1 * from table where call < @max order by call desc
Of course, if you have two calls which share the highest level, this returns the third.
Regards,
Rob Philpott.
|
|
|
|
|
yes thank you. I've done something similar. I selected the Top 2 and ordered them desc and then returned that value to another Top 1 sort and got the second highest. I do think yours is more effective though.
Thanks alot
|
|
|
|
|
hi all,
how to import data from excel to sql server 2005 either by using ado.net or asp.net 2.0 and c#
Ashok
|
|
|
|