Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
vinayakshukre
Starting Member
11 Posts |
Posted - 2008-12-13 : 01:52:22
|
| what is the data type of the cursor in SQL server ?is it always int ? |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
|
|
vinayakshukre
Starting Member
11 Posts |
Posted - 2008-12-13 : 02:06:35
|
| Thanks visakh for taking time on my issue.I understand cursor is itself a data type. But when get the data type of cursor column using java.sql.DatabaseMetadata.getProcedureColumn() method, I get it as int.so the confusion.Even if you look at the procedure from SQL server management studio express - > Programmability - >Stored Procedures -> dbo.myproc - > parameters ....cursor is shown as int. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-13 : 02:09:41
|
| cursor column? you mean a column defined in cursor? are you trying to get return value from procedure? |
 |
|
|
vinayakshukre
Starting Member
11 Posts |
Posted - 2008-12-13 : 02:13:59
|
| My procedure is herecreate procedure myproc@c1 cursor varying outputas set @c1 = cursor for select * from employee; open @c1I want to execute this procedure from java program.If i try to get the information of procedure's columns....i.e. @c1 I get it as int. |
 |
|
|
vinayakshukre
Starting Member
11 Posts |
Posted - 2008-12-13 : 02:19:14
|
| Java code to get the info is here...Connection con = DriverManager.getConnection(url,user,password) ;DatabaseMetaData meta = con.getMetaData();ResultSet rs = meta.getProcedureColumns(null, "dbo","myproc", null); ResultSetMetaData rsmd = rs.getMetaData();int iTotal = rsmd.getColumnCount();while(rs.next()){ for(int i=1 ;i <= iTotal;i++){ System.out.print(rsmd.getColumnName(i) + " = " + rs.getObject(i) + " \t\t\t"); } System.out.println(); }and output is hereCOLUMN_NAME = @RETURN_VALUE COLUMN_TYPE = 5 DATA_TYPE = 4 TYPE_NAME = int PRECISION = 10 LENGTH = 4 SCALE = 0 RADIX = 10 NULLABLE = 0 REMARKS = null COLUMN_NAME = @c1 COLUMN_TYPE = 2 DATA_TYPE = 4 TYPE_NAME = int PRECISION = 10 LENGTH = 4 SCALE = 0 RADIX = 10 NULLABLE = 1 REMARKS = null |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-13 : 02:27:04
|
| http://www.groupsrv.com/dotnet/about50204.html |
 |
|
|
vinayakshukre
Starting Member
11 Posts |
Posted - 2008-12-13 : 03:42:22
|
| Thanks once again visakh for this usefull information.I too had almost reached to the same conclusion that SQL server's cursor are not supported though JDBC.Thanks again. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-12-13 : 03:58:04
|
| welcome |
 |
|
|
|
|
|