i am not able to use @@spid inside view defination.sybase doesnot allow. how can i implement it inside view?. my requirement is: i have one table already existing in production server named MYTABLE. which have only one record at .so any select query form this table will give same output. now i want to create a table based on ip address corresponding value will be defines. and want to drop table MYTABLE and create a VIEW with the same name where it will use ip address to show corresponding output to based on ip address. can anybody have idea?
Asked
Active
Viewed 1,159 times
1 Answers
0
Try it this way:
create view your_view as
select spid from master..sysprocesses
where hostname = 'HOSTNAME'
-
i don't want to hardcode any value inside view e.g. hostname ,because for different host ,view definition should give different result. i want alternative of below query create view MYVIEW as select col1,col2 from TABLE1 where ipaddr in (select ipaddr from sysprocesses where spid=@@spid) – deepak Nov 28 '12 at 18:03
-
ah , we can use select host_name() for hostname – deepak Nov 28 '12 at 18:11
-
@deepak Did `host_name()` help? – Robert Nov 28 '12 at 18:57