| Author |
Topic |
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 03:25:11
|
| Can i know the syntax to get the remote ip address which has to be stored in a table. |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 03:25:56
|
Remote IP address of what? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 03:27:30
|
remote ipaddress of different client who access the serverquote: Originally posted by Peso Remote IP address of what? E 12°55'05.25"N 56°04'39.16"
|
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 03:31:07
|
You can get the machine name with select host_name() E 12°55'05.25"N 56°04'39.16" |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 03:35:07
|
hi peso txs for ur immediate reply,by using host_name().iam not able to store it in temp/normal table.but while exectuing through stord procedure it gets inserts,incase by calling the stored procedure through front end.someclassical execution error is thrown:quote: Originally posted by Peso You can get the machine name with select host_name() E 12°55'05.25"N 56°04'39.16"
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-11 : 03:37:56
|
quote: Originally posted by sent_sara hi peso txs for ur immediate reply,by using host_name().iam not able to store it in temp/normal table.but while exectuing through stord procedure it gets inserts,incase by calling the stored procedure through front end.someclassical execution error is thrown:quote: Originally posted by Peso You can get the machine name with select host_name() E 12°55'05.25"N 56°04'39.16"
why cant you store it in table? can i see your insert script? |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 03:41:26
|
He proabably builds a dynamic string in frontend... E 12°55'05.25"N 56°04'39.16" |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 03:45:40
|
CREATE procedure test_sp(@report_name varchar(100))asbeginDECLARE @HostName varchar(200)select @HostName = HOST_NAME()begin try begin transactioninsert into user_access_report(report_name,userid,access_date)select @report_name,@HostName,getdate()commit transactionend trybegin catchrollback transactioninsert into user_access_report(report_name,userid)select cast(error_number() as varchar), error_message()end catchendquote: Originally posted by visakh16
quote: Originally posted by sent_sara hi peso txs for ur immediate reply,by using host_name().iam not able to store it in temp/normal table.but while exectuing through stord procedure it gets inserts,incase by calling the stored procedure through front end.someclassical execution error is thrown:quote: Originally posted by Peso You can get the machine name with select host_name() E 12°55'05.25"N 56°04'39.16"
why cant you store it in table? can i see your insert script?
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-11 : 03:50:12
|
| why are you assgning value of host_name to userid? is it a varchar field? also does it have enough length to hold the returned value by hostname? |
 |
|
|
madhivanan
Premature Yak Congratulator
22864 Posts |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 04:20:27
|
1) from front end the sp is calling dynamically as peso said,2) secondly ,to keep track of reports accessed by user,this insertion logic is implemented.Regards/senthilquote: Originally posted by visakh16 why are you assgning value of host_name to userid? is it a varchar field? also does it have enough length to hold the returned value by hostname?
|
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-11 : 04:21:27
|
quote: Originally posted by sent_sara 1) from front end the sp is calling dynamically as peso said,2) secondly to keep track of user accessign the reports regulary,this insertion logic is implemented.Regards/senthilquote: Originally posted by visakh16 why are you assgning value of host_name to userid? is it a varchar field? also does it have enough length to hold the returned value by hostname?
on agreed. but you didnt answer me. whats the datatype of userid? |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 04:24:19
|
its varchar(20)quote: Originally posted by visakh16
quote: Originally posted by sent_sara 1) from front end the sp is calling dynamically as peso said,2) secondly to keep track of user accessign the reports regulary,this insertion logic is implemented.Regards/senthilquote: Originally posted by visakh16 why are you assgning value of host_name to userid? is it a varchar field? also does it have enough length to hold the returned value by hostname?
on agreed. but you didnt answer me. whats the datatype of userid?
|
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 04:27:52
|
quote: Originally posted by sent_sara its varchar(20)
And what is the length of the data HOST_NAME() returns? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2008-08-11 : 04:28:03
|
| and whats the error obtained when you try to insert it? also it would be good if you can post dynamic script where you try to insert. |
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 04:28:59
|
Change VARCHAR(20) to VARCHAR(30). E 12°55'05.25"N 56°04'39.16" |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 05:19:36
|
Hi peso,now the data getting insertedreport name user id date snoFlash report RAMCOVM392.rsimail.rsil.ramco.com 2008-08-11 14:47:05.730 312thought it is coming from front end ,its getting saved as server name.i need to save the client machine name or ipaddressquote: Originally posted by Peso Change VARCHAR(20) to VARCHAR(30). E 12°55'05.25"N 56°04'39.16"
|
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 05:29:52
|
It is VERY easy to get the CLIENT name (and even the client IP) from the CLIENT application!Just call the WINDOWS API, and supply the information to the database in your dynamically constructed string. E 12°55'05.25"N 56°04'39.16" |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 05:44:54
|
hi peso,though it comes from front end application[ERP Product]we can't modify the front end.sp logic alone it is possible to modify.whether there is any alternative way to do??quote: Originally posted by Peso It is VERY easy to get the CLIENT name (and even the client IP) from the CLIENT application!Just call the WINDOWS API, and supply the information to the database in your dynamically constructed string. E 12°55'05.25"N 56°04'39.16"
|
 |
|
|
SwePeso
Patron Saint of Lost Yaks
30421 Posts |
Posted - 2008-08-11 : 05:47:25
|
The only way to get the SERVERNAME with HOST_NAME() function is when you run the code ON the server itself.Are you running the Application with CITRIX or similar ON the database server? E 12°55'05.25"N 56°04'39.16" |
 |
|
|
sent_sara
Constraint Violating Yak Guru
377 Posts |
Posted - 2008-08-11 : 07:05:10
|
Txs for every one.quote: Originally posted by Peso The only way to get the SERVERNAME with HOST_NAME() function is when you run the code ON the server itself.Are you running the Application with CITRIX or similar ON the database server? E 12°55'05.25"N 56°04'39.16"
|
 |
|
|
Next Page
|