User Profile

Collapse

Profile Sidebar

Collapse
SnehaAgrawal
SnehaAgrawal
Last Activity: Oct 8 '10, 10:44 AM
Joined: Apr 17 '09
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • How to return current status from a stored procedure to my Vb.Net program?

    Hi,
    See if someone could help me with the following...

    I have a stored procedure which I call from my Asp/Vb prog.
    In that stored proc. I have written Insert,Update and many operations.I want my SP to return the status i.e Insert successfull etc. so that I can show it in a progress bar(or Label).I dont want to print msgs using PRINT in SP.Bcoz it prints after the SP is fully executed...

    Thanks
    See more | Go to post

  • SnehaAgrawal
    started a topic Login failed for user(null)

    Login failed for user(null)

    Hi,
    See if someone could shed some light on the following

    I am getting an error

    Login failed for user(null)
    Reason:Not associated with a trusted SQL Server Connection.

    I am using SQL Server 2000

    I have 2 servers

    ServerA(Databas eA)
    ServerB(Databas eB)

    I try to do the following

    ServerA------>DatabaseA----->Storedproc inserting...
    See more | Go to post

  • SnehaAgrawal
    started a topic Row locking in a table in Remote Database

    Row locking in a table in Remote Database

    Hi,
    I want to lock a row in a table which is in Remote Database.
    I tried XLOCK but it says that XLOCK cannot be used in Remote Database.
    See if someone could help me.
    See more | Go to post

  • SnehaAgrawal
    started a topic Condition check for If table exist

    Condition check for If table exist

    How can I use the following Query using Dynamic Sql.The purpose of using Dynamic SQL is the table is on another server.

    Generally when I use Dynamic SQL against select query I use
    EXEC('SELECT * FROM '+@SERVERNAME+' .'+@LOCALDBNAME +'.DBO.'+'ÇUSTO MERS')

    Here goes my Query

    if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[MyTable]') and OBJECTPROPERTY( id, N'IsUserTable') = 1)...
    See more | Go to post

  • SnehaAgrawal
    replied to If exists table using dynamic sql
    I didn't get u?
    What I am trying to do is use the following query if that particular table exist in my DB.
    The query is

    select * from @Tablename

    @Tablename is my parameter passed from my prog.
    before using the select query I just wanna check if that table exists in my DB if Yes then go for select else return from my SP

    could u help out with this?
    See more | Go to post

    Leave a comment:


  • SnehaAgrawal
    started a topic If exists table using dynamic sql

    If exists table using dynamic sql

    Hi
    I want to check if a particular table exists or not in my DB.But that I have to check using dynamic sql.Can anyone provide me with the syntax
    See more | Go to post

  • SnehaAgrawal
    replied to While loop with dynamic sql
    Hi I want to know how can I use a Dynamic SQL Statement inside a While loop

    I mean In cursors we fetch rows one by one how can I do that in a while loop that too using Dynamic SQL bcoz I have to access a different server.No issues regarding SQL Injection bcoz this is done internally user isn't invloved.
    See more | Go to post

    Leave a comment:


  • Cannot specify an index or locking hint for a remote data source

    Hi see if u could help me with the following

    I am accessing a table which is on another DB.
    But when I write Select LinkNo from ServerName.DBNa me.dbo.LinkMast er with(XLOck) where Linkid=25

    It gives me the following error
    Cannot specify an index or locking hint for a remote data source
    May be the error is due to I m trying to lock a row which is on another server...Could someone suggest me any so...
    See more | Go to post

  • Syntax error converting datetime fom character string

    Hi I get the error "Syntax error converting datetime from character string "for
    the following sql statement in Stored proc.

    SET @dynamicSQL =N'SELECT CUSTID,SHCodeLi nk FROM AccountMaster where CONVERT(DATETIM E,OPDATE,105) < = '''+CONVERT(DAT ETIME,@ACCYEAR, 105) +''' And GLCode = '+@DIVGLCODE

    EXEC(@dynamicsq l)
    See more | Go to post

  • SnehaAgrawal
    started a topic Database Locking

    Database Locking

    Hi I want to know how can I lock my database...I mean if someone wishes to see he should be able to see only Database Name He should not be able to see tables,Sp's,UDF 'S...I don't want to set permissions bcoz permissions can be changed by ADMIN...
    See more | Go to post

  • SnehaAgrawal
    replied to While loop with dynamic sql
    Thnks for ur reply ..I want to know how can I use the following statement inside while loop
    'Select * from '+@localDBName+ '..Customers'
    See more | Go to post

    Leave a comment:


  • SnehaAgrawal
    replied to While loop with dynamic sql
    The above code is just a part of my SP.In that SP I m already using a cursor and in ttht cursor I m using while loop...Bcoz cursors have the tendency to make system slow I think so it wont be a good prog. approach to use it..so could u plz help me
    See more | Go to post

    Leave a comment:


  • SnehaAgrawal
    started a topic While loop with dynamic sql

    While loop with dynamic sql

    Hi could you please help me with the following...
    The syntax for while loop is

    While Exists(select * from Customers)
    End While

    How can I use the above select statment using dynamic SQL?
    See more | Go to post

  • Hi the proc is correct just one closing bracket is missing
    (int,max(substr ing(centreid,3, 13)))
    I hope u got the ans.
    See more | Go to post

    Leave a comment:


  • SnehaAgrawal
    started a topic Search a row by Primary Key

    Search a row by Primary Key

    Hi,
    I have a table with 1000 records..I want to serach a row or want to go to a particular record...If I go by normal proc. I m sure it wud be a table scan I want to know is it possible by using indexing or primary key to go yo a particular record?If yes then how?
    See more | Go to post

  • Hi I got the solution u were right @Opbalance was NULL I just checked it using IF-Else it worked...thnks
    See more | Go to post

    Leave a comment:


  • One thing I forgot to mention tht I am using Dynamic sql the Queries are as as follows
    Code:
    SET @SQLSTRING=N'SELECT @DEPOSITOUT=DEPOSIT FROM '+@globalDBName+' ..GDayBalance WHERE CustID=@CustID'
    				SET @PARAMDEFINITION=N'@CUSTID char(12),@DEPOSITOUT NUMERIC(16,2)  OUTPUT'
    				SET @INTVARIABLE=@CUSTID
    				EXECUTE SP_EXECUTESQL @SQLSTRING,@PARAMDEFINITION,@CUSTID=@INTVARIABLE,@DEPOSITOUT=@DEPOSIT OUTPUT
    
    				SET
    ...
    See more | Go to post

    Leave a comment:


  • Now in the above SP the Opbalance field in my table is 0
    But it may not be Zero all the time...
    So after retreiving from table I wish to check if its 0 the assign 0 to @Opbalance bcoz it does not calaculate then...
    See more | Go to post

    Leave a comment:


  • The Test SP
    Code:
    Create Procedure TestPro
    @CUSTID AS CHAR(12)
    AS
    DECLARE @OPBALANCE AS NUMERIC(16,2)
    DECLARE @DEPOSIT AS NUMERIC(16,2)
    DECLARE @WITHDRAWAL AS NUMERIC(16,2)
    DECLARE @CLBALANCE AS NUMERIC(16,2)
    
    SET @OPBALANCE=(SELECT OPBALANCE FROM GDAYBALANCE WHERE CUSTID=@CUSTID)
    SET @DEPOSIT =(SELECT DEPOSIT FROM GDAYBALANCE WHERE CUSTID=@CUSTID)
    SET @WITHDRAWAL=(SELECT WITHDRAWAL
    ...
    See more | Go to post
    Last edited by NeoPa; Apr 28 '09, 12:45 PM. Reason: Please use the [CODE] tags provided

    Leave a comment:


  • Do u mean I should post the test proc. here
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...