Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: habneh
  • Content: Threads
  • Order by date
  1. habneh

    help with the duplicate column values

    I have tables say tbl1, tbl2, tbl3 I am joing this table to get back some recordsets select a.col1 b.col2 c.col3 from tbl1 a inner join tbl2 b on a.col1 = b.col2 inner join tbl3 c on b.col1 = c.col2 the resultset will teturn col1 col2 col3 1370 1446 aa...
  2. habneh

    Problem with a NULL field

    I have two tables, @tmpTable4 and @ReportTable, I wrote this script to update the last two fields of table @tmpTable4 i.e. ISDEL and REMARK with the last two fields of @ReportTable but it is not updating what will be the reason here is the script SET ANSI_NULLS OFF GO DECLARE @ReportTable...
  3. habneh

    passing server name as parameter

    I wrote a query which can be run on different servers I want to pass the server name and database name as a parameter to my query. how can I do that can I do select * from @servername.@databasename.dbo.tbl Thanks
  4. habneh

    What is wrong with this query?

    I want to update a table tbl on serer svr1 and database db1 update tmp set tmp.col = case when tmp.col1 = 1 then tmp.col1 + 1 else tmp.col1 + 2 end from OPENROWSET('SQLOLEDB','svr1';'uid';'pwd','select * from db1.dbo.tbl') tmp but it is erroring the...
  5. habneh

    update tables on another server

    I have a table called tbl on server svr1, database db1, owner is dbo I want to update it from server svr2, database db2 I wrote a query update svr1.db1.dbo.tbl set col1 = case when col1 = 1 then 1.0 else 2.0 end where col2 = 'aa' but it is complaining what should...
  6. habneh

    Problem with null

    I am trying to get the max employee change number for some reason when an employee doesn't have change number i.e when it is null, my query doesn't pick that specific record. below is the query I wrote what is the problem with my query create table #tmp (ID int, EMP_ID int, EMP_VER_NUMBER...
  7. habneh

    Query problem

    Here ia another query problem, I know for most of you guys it is easy. I have a table say tbl id Catagory values 1 Min 0 1 Max 8 2 MIN 18 2 Max NULL 3 MIN NULL 3 Max 60 NB if min or max value is not given for min we take 0 for max we take 1000 each id has min and...
  8. habneh

    TSQl problem

    Here is my problem I have a table say trialId country 1 USA 1 canada 1 Jamaica 2 USA 3 Afganistan 4 India 4 S. Africa I want to get trials conducted in US but nowhere else resultset should look like trialId country 2...
  9. habneh

    sumup distinct values

    I want to sum up distinct values of a column how can I do that ex col1 col2 1 1 1 1 1 1 1 2 1 2 1 3 the result set should be col1 col2 1 6 thanks
  10. habneh

    need help on like keyword

    I have a table say tbl col1 col2 1 aa 2 aabc 3 bb 4 bbkk 5 cc 6 dd I want to select all records from tbl1 excluding records that have col2 values starting aa and bb therefore my result set should look like col1 col2 5 cc 6 dd thanks
  11. habneh

    getting the total number of records

    I have a table say tbl1 col1 col2 1 aa 2 bb 3 cc 4 dd I would like to select all records and the total number of records in single statemet here is what the recordset I want noRecords col1 col2 4 1 aa 4 2 bb 4 3 cc 4...
  12. habneh

    caching a resultset

    Here is my question, please tell me whether we can do it or not. can we cache a resultset of a query for later use, like we cache an execution plan of a query to be reused later. The reason I am asking is I want to catch a resukt of a query and reuse it later unless the result set is changed...
  13. habneh

    TSQL problem

    declare @name varchar(1000) set @name = '' 1 select @name = @name + convert(varchar(1000),id)+ ', ' from tbl 2 select @name How can I combile statement 1 and 2 so that I can do it in a single statement select (select @name = @name + convert(varchar(1000),id)+ ', ' from tbl) gives me an...
  14. habneh

    loop problem

    I was replacing a cursor with a while loop and I am facing one minor problem but its impact is so big. see the code //variables declared here select @id = min(id) from table1 while @id is not null begin select @name = name @date = date from table1 where id = @id //do some thing...
  15. habneh

    Max row size problem

    I am working on sql server 2000, I am facing an exceeding max row size problem, Is there a way, I can mitigate this problem? I am selecting certain columns, and when I am tring to sort them, it is complaing that it is not sorting because it exceeded the 8K limit. what should I do thanks,
  16. habneh

    sql statement help

    I have two table say tbl1 col1 col2 1 xx 2 yy 3 zz 4 dd and tbl2 col1 col2 1 rr 3 kk 4 ll now I want to select record from tbl1, if tbl2 doesn't have any record I will select all records from tbl1 otherwise I will select those records...
  17. habneh

    adding identity column to existing table

    Hello everyone Hope you have a great easter weekend I have one que I have a table say tbl1 col1 col2 a xx a yy b zz c ff c gg I want to add an indentity column to this existing table so that it will be like this after I will have added the identity...
  18. habneh

    replacing a cursor

    I always think replacing all the cursors defined in all my procedures. I was able to do it for those that have column (primary key or unique key) to identify each row uniquely with the while loop but I can't do it for those who don't have a uniue key. how can I replace those cursors defined...
  19. habneh

    join statement question

    I have three tables tbl1 --which is the main table col1 col2 1 aa 2 bb 3 cc 4 dd tbl2 col1 col2 (foreign key to tbl1 (col1)) 1 2 2 2 3 1 4 3 tbl3 col1 col2 (foreign key to tbl1 (col1)) 1 4 2 3 3 3 4...
  20. habneh

    team foundation

    Hello everyone, We are moving from source save to TEam foundation. can anybody tell me what can a sql server developer do for this process (for the migration). That will help me to specifically study and prepare myself. I am totally new to it. Thanks, Teddy

Part and Inventory Search

Back
Top