User Profile

Collapse

Profile Sidebar

Collapse
iburyak
iburyak
Last Activity: Sep 24 '09, 02:58 PM
Joined: Nov 28 '06
Location:
  •  
  • Time
  • Show
  • Source
Clear All
new posts

  • iburyak
    replied to Sql insert cursor
    Can you order by date in descending order instead of ID??
    Try to use cursors as little as possible you can insert whole table in one shot why would you use cursor for that?
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to While loop with dynamic sql
    Try this example:

    Code:
    declare @a table (ID int, Val varchar(10))
    insert into @a values(1, 'aaa')
    insert into @a values(2, 'bbb')
    insert into @a values(3, 'ccc')
    insert into @a values(4, 'ddd')
    
    Declare @ID int 
    Select @ID = min(ID) from @a
    
    While Exists(select * from @a where ID >= @ID)
    BEGIN
    	Select * from @a where ID = @ID
        Select @ID = min(ID)
    ...
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Search a row by Primary Key
    If you have a correct index over primary key it should use it but on the other hand for 1000 rows server might choose table-scan because it is not much data to scan in a first place. Please, provide more details on table structure, index information and query you use....
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Display flag if record exists in table
    Try this:

    Code:
    select u.userdescription as 'username', 
           u.loginid 'login id',
           (case  
    		  when max(cgm.objectid) is not null Then 'Y' 
    		  else 'N' 
    		end) as IsCoverageGroupMember 
    from hsuser u 
    left outer join hscovgroupmember cgm 
        on u.objectid = cgm.user_oid 
    left outer join hscovgroup cg 
        on cgm.covgroup_oid = cg.objectid 
    group by u.loginid,u.userdescription
    ...
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to how can i fix this!
    This question is too generic.
    Try testing your connection using ODBC utilities first.
    Go to:
    Start - Settings - Control Panel - Administrative Tools - Data Sources(ODBC)

    Good Luck.
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Need help with MIN function
    I don't see data to help you better.

    So try this:

    1. Create Function:
    Code:
    Create function fGetMin(@A1 int, @A2 int, @A3 int, @A4 int, @A5 int)
    Returns int
    AS 
    BEGIN
    Declare @Res int
    Select @Res = min(Col)
    From (Select @A1 Col
          Union
          Select @A2
          Union
          Select @A3
          Union 
          Select @A4
          Union
    ...
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Need help with error on JOIN statement
    Try this:

    Code:
    UPDATE AST_ComputerSystem 
    SET AST_ComputerSystem.Supported = '1' 
    from AST_AssetWarranty
    INNER JOIN AST_CMDB_Associations ON AST_AssetWarranty.instanceId = AST_CMDB_Associations.Request_ID02 
    INNER JOIN AST_ComputerSystem ON AST_ComputerSystem.Reconciliation_Identity = AST_CMDB_Assocations.Request_ID01
    WHERE(AST_AssetWarranty.Expiration_Date > Currentdate)
    Good Luck.
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Double Insert Statement Probs
    Check if TblUser_ID has a column Personel_No

    It is hard to tell because I don't see your database objects.

    Comment out pieces of your code and run it to find which one is having a problem.

    Good Luck.
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Database Objects
    Try this:

    Code:
    Select * from sysobjects
    Good Luck.
    See more | Go to post

    Leave a comment:


  • Create a user_id column for sure.
    Can you imagine creating a new set of tables for each user instead of just inserting some records into a table?
    You can create an index over the user_id column or combine it with another unique id in this table to make it even more robust. No blocks should be happening if each user should go after his own data only. Server 2008 should be so fast that even if users would go after the same data it should...
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Not In
    Depend on your data try one of these:

    Code:
    Select email_id from table_name where  not exists(select process_id from table_name)
    Or 
    Select email_id from table_name where  process_id is null
    Good Luck.
    See more | Go to post

    Leave a comment:


  • Try this:

    Code:
    declare  @a table (CrDate datetime,  Dishes int) 
    
    insert into @a values ('2008-09-01 00:05:04.483', 1)
    insert into @a values ('2008-09-01 00:06:31.653', 1)
    insert into @a values ('2008-09-01 04:35:44.983', 1)
    insert into @a values ('2008-09-09 08:51:20.857', 1)
    insert into @a values ('2008-09-09 08:52:08.873', 1)
    insert into @a values ('2008-09-09 08:52:47.280', 1)
    ...
    See more | Go to post

    Leave a comment:


  • Try this:

    Code:
    insert into tableA values ('NameofGuy', (Select Top 1 id from tableB where roleDescription = 'Administrator'), (Select Top 1 id from tableC where companyName = 'CompanyX'))
    I use Top 1 to make sure that only one record will be returned you can use max or min as well.

    Good Luck.
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to SQL LIKE help
    Try this:

    Code:
    SELECT *
    FROM (
    	SELECT A.ID,A.date1,A.rmc_value,A.userid,B.formula,B.fini shedgood,B.rawmaterial,
    	(SELECT C.desc1 FROM C WHERE C.ID=B.finishedgood AND B.finishedgood>0) AS f_item,
    	(SELECT C.desc2 FROM C WHERE C.ID=B.finishedgood AND B.finishedgood>0) AS f_desc,
    	(SELECT D.desc1 FROM D WHERE D.ID=B.rawmaterial AND B.rawmaterial>1) AS r_item,
    	(SELECT D.desc2 FROM D WHERE
    ...
    See more | Go to post

    Leave a comment:


  • See if you can shrink tran log and temdb.
    When you'll free up some space your other commands will run faster.

    Good Luck....
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to LoadFromSQLServer failed
    One of my servers has unrelated problem and we noticed that it resolves a problem with server reboot. We found that solution requires significant expanse which we were not ready for, basically we need to replace existing server. So identifying a problem led to solution. Now, we reboot server on schedule once a week which gives us a breathing room and time to schedule nonemergency server replacement.

    Thanks for respond.
    Good...
    See more | Go to post

    Leave a comment:


  • This is great I love this approach.
    I’ll use it in a future for sure.

    Thanks....
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to Global Temp Table (with .NET)
    Global temp table stays in memory for as long as at least one connection is opened to it. If you create a table and disconnect and another connection tries to read data from the same table but a little later table is already out of scope or no longer exists.

    Hope it explained your problem.
    Create a permanent table and just empty or reload it whenever needed.

    Good Luck.
    See more | Go to post

    Leave a comment:


  • iburyak
    replied to How do I use bcp to insert into sybase
    Sorry, I didn't do Sybase for a while and don't have server to test on. So from the top of my head:

    1. Search for bcp.exe on your computer.
    2. Open cmd prompt and change to that direcgtory.
    3. Run something like this:
    bcp database_name.o wner.table_name in datafile -n -U username -P password

    For more info go to:

    http://manuals.sybase.com/onlinebook...util/@Generic_...
    See more | Go to post

    Leave a comment:


  • To free up space is tedious job and takes days sometimes to do it and in many cases need space. So I am not mistaken you need space to free up space.

    1. I will get back to you in couple of hours with a script that will help you identifying largest tables on which you should work first.
    2.It takes a lot of time because you don't have space and as soon you'll free up some it will get easier.
    3. For now you can just do...
    See more | Go to post

    Leave a comment:

No activity results to display
Show More
Working...