is possible to put a instruction declare inside in a view??

  •  

    for example is possible to do that???

    CREATE view CVW_Callas as

     

    declare @a int

    select * from MyTable

     

    i got the next error

    Server: Msg 156, Level 15, State 1, Procedure CVW_Calls, Line 5

    Incorrect syntax near the keyword 'declare'.

    Thaks for your helping

  • You can't do that.

     

    With more details we could provide an alternative...

  • Ok no problem i will put the values without variable

     i just want to know if would be possible to do that,  thanks for read me

  • It's not a good idea to put those values directly in the code.  You're better off putting them into a table a selecting from that table.

  • You could probably could look into sql server "functions" used as parameterized views.


    * Noel

Viewing 5 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply