|
Piyush Vardhan Singh wrote: and SQL Server 2005 inbuild in opertaing system
If you cannot access it, how do you know it is there?
|
|
|
|
|
|
Hello!
I have a table which has a text column.
I need to modify this column for all rows that begin with some text.
How can I do it?
Thanks in advance!
Have a nice day!
|
|
|
|
|
UPDATE table_name
SET column_name = new_value
WHERE column_name like '%some text'
You should really read up on SQL if you have to ask this kind of questions. I suggest you read w3schools[^] articles on sql.
|
|
|
|
|
i write store procedure for the time .it insert time in the database before inserting it check this time is already
exit or not .if exit it not allow me to insert and rasise error
butit not work it give error on starting "begin" statement
i don't understand where i am doing wrong
someone help me to reconver this error
CREATE PROCEDURE InsertTiming(@timing nvarchar(255))
BEGIN
SET NOCOUNT ON;
-- Check if timing already exists
DECLARE @tmp nvarchar(255);
SELECT @tmp = s_time FROM timing WHERE s_time = @timing;
IF @tmp IS NOT NULL
BEGIN
raiserror(N'Timing %s already assigned',
10,
1,
@timing);
END
-- Insert new value
INSERT INTO timing(s_test) VALUES (@timing);
END
okey
|
|
|
|
|
MSDN : CREATE PROCEDURE[^]
In short, you're missing the AS keyword before BEGIN.
SG
Cause is effect concealed. Effect is cause revealed.
|
|
|
|
|
i use as statement
but it give me error on
@timing
okey
|
|
|
|
|
hello there,
im updating my table of about 1300 rows through C# but i always got error that server time out, then i copied the query and executed in the sql, and it took 25 secs that is too much
the query is written something like this :
update mytable set id = '1100001',deptid = 1, Cid = 1 where id = 'A1100001'
update mytable set id = '1100002',deptid = 1, Cid = 1 where id = 'A1100002'
update mytable set id = '1100003',deptid = 1, Cid = 1 where id = 'A1100003'
.
.
.
.
here are around 1300 lines like this,
about table
id nvarchar(25) PK
deptid tinyint
Cid tinyint
any idea how to speed up?? because 25 secs with core2 processor is too much
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
|
|
|
|
|
declare @i as int <br />
set @i=0<br />
declare @value as varchar(50)<br />
set @value='1100000'<br />
declare @newvalue as varchar(50)<br />
set @newvalue=''<br />
declare @Avalue as varchar(50)<br />
set @Avalue='A1100000'<br />
<br />
while @i<=1300 <br />
begin<br />
set @i=@i+1<br />
<br />
set @newvalue = substring(@value,1,len(@value)-len(convert(varchar,@i)))+''+convert(varchar,@i)<br />
set @Avalue = substring(@Avalue,1,len(@Avalue)-len(convert(varchar,@i)))+''+convert(varchar,@i)<br />
select @newvalue<br />
update mytable set id = @newvalue,deptid = 1, Cid = 1 where id = @Avalue<br />
end
I Love SQL
modified on Friday, April 4, 2008 1:20 AM
|
|
|
|
|
may i ask what is the difference ?, you are also updating like this
update mytable set id = @newvalue,deptid = 1, Cid = 1 where id = @Avalue
thanks
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
modified on Friday, April 4, 2008 4:40 AM
|
|
|
|
|
did u try if it is more effective?
I Love SQL
|
|
|
|
|
no, i cant use that way, because im making query from C#, where id is not in sequence, it can be A923 or A382
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
|
|
|
|
|
oh OK, sorry on my unusefull answer...
did u indexed fields of table?
I Love SQL
|
|
|
|
|
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
|
|
|
|