|
Hi all
i wana come to know that how can i return cursor from a stored procedure???
Regards
Qaiser
|
|
|
|
|
I think A cursor is a server side thing. You can't "return" this to a client.
Anyway why do u need this??
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
Why you need to return a cursor from a Stored Procedure ? I think you got confused with Oracle .. Is it ?
|
|
|
|
|
Hi All
i want to get top 5 records from the table. what would be the query?
Regards
Qaiser
|
|
|
|
|
Returning only the first N records in a SQL query differs quite a bit between database platforms. Here's some samples:
Microsoft SQL Server
SELECT TOP 10 column FROM table
PostgreSQL and MySQL
SELECT column FROM table<br />
LIMIT 10
Oracle
SELECT column FROM table<br />
WHERE ROWNUM <= 10
Sybase
SET rowcount 10<br />
SELECT column FROM table
Firebird
SELECT FIRST 10 column <br />
FROM table
Tirtha
Do not go where the path may lead, go instead where there is no path and leave a trail.
Author: Ralph Waldo Emerson (1803-82), American writer, philosopher, poet, essayist
|
|
|
|
|
I've created a dll (with vb6) to call a webservice, and this works fine when called in vb6.
I need to run this from stored procedure in SQL Server 2000,
because we have many clients that run application that access an SQL server.
It'll be hard work to install the dll into each of the clients pc (and many of them don't have MS SOAP installed), so instead I've been planning to install the dll in the server that runs SQL server, while others clients can just use store procedure to get the result from the webservice (which access to another SQL server machine).
We've tried using linked server but the response is too slow.
When I've tried to create store procedure to access the dll, it always return NULL value.
Anyone can help with this problem?
Thanks in advance,
Chronos
|
|
|
|
|
Have a good day.
Must i create alias and tables on my pc while design and copy them with setup or must i create them in installed pc.
so my real question,
i want to create password protected tables to use but i couldnt create this table in run time.i can do it from database desktop->restructure menu.
İs there anyway to create this table in runtime or make a table which is not protected in c++ and restruct it in c++;
thanks.
|
|
|
|
|
Hi,
I have a stored procedure which is having a input parameter as TEXT datatype. I am passing a string to it whose length is 9000. It does not accept more then 8000 characters of the string. How to solve this issue?
Is there any method in which i can increase the length of the datatype. or is there any other datatype whose datalength is more then 8000?
Thanks,
Riz
|
|
|
|
|
to my knowledge 8000 is max. in SQL Server 2000
Regards
KP
|
|
|
|
|
If you're using classic ADO, you must use the adLongVarChar datatype for the parameter, and use AppendChunk to write the data to the parameter rather than simply assigning the Value property.
For ADO.NET and the SQL Server data provider, use the SqlDbType.Text type.
|
|
|
|
|
Hi,
Thanks for ur reply....
I want to know how exactly to implement it in the stored procedure. Can u give me an example? It's very urgent.
Thanks,
Riz
|
|
|
|
|
Hi i am week in query,
plz solve my probs...,
the following queries,that first query and second query both are working...,
Now my question is,
What are the fields, i am getting in the two queries those want to show in single query...,
Means,in first query ur giving date in that it want to take the year only
and check with tblmonthhourdetails.sdate
and same time the tblmonthhourdetails empid want to equal with the employeemaster.empid
------------------------------------------------------------------
SELECT dbo.tblEmployeeMaster.empId, dbo.tblEmployeeMaster.empName,
dbo.tblTimeCardmain.carddate, dbo.tblTimeCardmain.reportingtime,
dbo.tblTimeCardmain.leavingtime, dbo.tblSalaryDetails.Whrs,
dbo.tblTimeCardmain.shift, dbo.tblTimeCardmain.projectid
FROM dbo.tblEmployeeMaster INNER JOIN dbo.tblTimeCardmain ON
dbo.tblEmployeeMaster.empId = dbo.tblTimeCardmain.empid INNER JOIN
dbo.tblSalaryDetails ON
dbo.tblEmployeeMaster.empId = dbo.tblSalaryDetails.EmpID
WHERE dbo.tblTimeCardmain.carddate = '5/2/2007'
AND dbo.tblTimeCardmain.app1 = 1 AND
dbo.tblTimeCardmain.projectid = 100
-----------------------------------------------------------------------
SELECT SUM(MedicalLeave) AS Ml, SUM(AnnualLeave) AS AL, EmpId
FROM dbo.tblMonthHourDetails
WHERE (DATEPART(YYYY, SDate) = 2007)
GROUP BY EmpId, SDate
-----------------------------------------------------------------------
Plz hlp me...,
-- modified at 1:05 Thursday 14th June, 2007
Magi
|
|
|
|
|
Hi Magi
Try this:
SELECT EM.empId, EM.empName, TC.carddate, TC.reportingtime,
TC.leavingtime, SD.Whrs, TC.shift, TC.projectid,
(SELECT SUM(MedicalLeave) FROM dbo.tblMonthHourDetails MHD
WHERE MHD.EmpId = EM.empId AND YEAR(MHD.SDate) = 2007) AS ML,
(SELECT SUM(AnnualLeave) FROM dbo.tblMonthHourDetails MHD
WHERE MHD.EmpId = EM.empId AND YEAR(MHD.SDate) = 2007) AS AL
FROM dbo.tblEmployeeMaster EM
INNER JOIN dbo.tblTimeCardmain TC
ON EM.empId = TC.empid
INNER JOIN dbo.tblSalaryDetails SD
ON EM.empId = SD.EmpID
WHERE TC.carddate = '5/2/2007'
AND TC.app1 = 1
AND TC.projectid = 100 I have used table aliases (EM, TC, etc) to make your query more readable. Correlated sub-queries are used to get the medical and annual leave.
Regards
Andy
|
|
|
|
|
Thanks lot...,
Its working cool,
Keep in touch,
Take care,
Magi
|
|
|
|
|
Magh_M wrote: Query doubt.
You have a question, not a doubt.
|
|
|
|
|
Hi,
I have one table like
sno name
--- ------
1 hai
2 hello
3 hai
4 hello
5 hello
6 bye
7 take care
from the above table i want to display only duplicate values like
sno name
---- ------
1 hai
2 hello
3 hai
4 hello
5 hello
how to display it ?
|
|
|
|
|
SELECT * FROM tableA WHERE name IN (SELECT name FROM tableA GROUP BY name HAVING Count(*) > 1)
Here Sub-Query retruns only those names which are present more than once and main Query returns all rows where the same is present.
Regards
KP
|
|
|
|
|
I wish to know if there is any way to create a trigger that runs when a user makes some insert / update / delete action on a table of a database and then add the same values to a table that dwells in another separate database, both Sql-Server. How can I use the table in the external database? is it possible?
Thanks.
|
|
|
|
|
hi
It is possible,
just call the tablename like
databasename.dbo.tablename
k.ravi sankar
|
|
|
|
|
If the table is not owned by dbo then?
Regards
KP
|
|
|
|
|
Yay, it worked nice!
thanks a lot, mate.
|
|
|
|
|
andreumv wrote: How can I use the table in the external database?
does this mean both databases are not in one server. if so, you need to link both using sp_addlinkedserver check online help for syntax and usage.
once after linking you can access the tables like <server>.<database>.<owner>.<table>
if both databases are on same then
<database>.<owner>.<table>
I've used both (in queries/functions/procedures) exceipt in triggers
Regards
KP
|
|
|
|
|
Hi,
I have a table in which I have four columns.
ID (primary Key)
FirstName,
LastName,
Email
I want to add another column as @@identity in this already existing
table.
How can I do that.
seema
|
|
|
|
|
If ID is an integer then you would do:
alter table MyTable alter column
ID integer identity(1,1) not null When you insert new records then you use @@identity to show the identity number that SQL-Server has allocated to your new record:
Insert into MyTable (FirstName, LastName, Email)
values ('Andy', 'Harman', 'Andy@AndysWorld.com')
Select @@Identity You can find out more about this in the SQL Server Books-Online.
Regards
Andy
|
|
|
|
|
Hi All,
I am working on SQL SERVER 2000.I have a problem of Characters maximum length.I declared a cloumn of length 2000 characters of Data type Char.But it is taking only 255 characters.even i tried with ntext,text,varchar,nvarchar datatyupes with 2000 length but it is accepting 255 characters only.No restriction from coding side as well.
Plase any help me to solve this problem.
Thanks & Regards
S.Raju.
|
|
|
|