Forum Replies Created

Viewing 15 posts - 256 through 270 (of 326 total)

  • RE: How to re-write this query in a better and faster way?

    Thanks for trying it Todd. Actually the quary you gave returns different previous no for a given Phone number. My requirement is that the values of column "Just previous number"...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: How to re-write this query in a better and faster way?

    ok, this is what I am trying to achieve:

    if is_transferred <>0 then I want the most recent transferred_to_phone_no. That is why order by date is done. So essentially "just previous...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: SQL QUERY OUTPUT

    IF EXISTS (

    SELECT *

    FROM dbo.sysobjects

    WHERE 1=1

    AND id = object_id(N'dbo.xxx')

    AND OBJECTPROPERTY(id, N'IsUserTable') = 1)

    DROP TABLE dbo.xxx

    the condition 1=1 is redundent as it is always true.

    id = object_id(N'dbo.xxx') ...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: memory utilization

    If you meant , how to do it using command from SQl box, then you may use:

    xp_cmdshell 'typeperf "\Memory\Available bytes" "\processor(_total)\% processor time"'

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Is there any advantage of using a clustered key in NC index?

    Yes, they won't be added again. Just to elaborate it more:

    I have a clutered index idx1 on Col1 and a non Clustered index on Col2,Col3. if my predicate is like...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Is there any advantage of using a clustered key in NC index?

    Thanks for your answers Gail....Now I don't see any point in dropping the name of clustered key from my NC index definition.

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Is there any advantage of using a clustered key in NC index?

    Many thanks Gail..My thinking was that if the NC index is able to implicitly use the Clustered key, what is the point in adding it to the NC? Won't it...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Plan handle is generated but query plan is not??

    There is no memory pressure. Its a development box and I am the only person doing work on it. And also if I execute other procs and check their plans...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: sys.syscacheobjects and sys.objects

    That is the catch here Gail.

    If I run below query:

    select * from sys.dm_exec_cached_plans a cross apply sys.dm_exec_sql_text(plan_handle)

    I can see from text column that the plan is for a proc. I...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Execute a stored procedure inside a user defined function

    Vivek

    You can use exec in funtion but only for extended procs. Here I have created a batch file which I executed using:

    exec master..xp_cmdshell 'c:\runproc.bat'

    runproc.bat is the batch file here...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: sys.syscacheobjects and sys.objects

    I knew that gail but since it was having objid, i thought of using it. but even the DMV's you mentioned wont give me the name of the proc corresponding...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Cannot delete db on sqlserver

    what do you get for your database when you run this:

    select state_desc from sys.databases where name='test'

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Dynamic query in a function

    WayneS (11/23/2010)


    Have you tried creating this function in the other database, and just calling it?

    i.e.:

    alter function db.dbo.fn1

    returns int

    as

    begin

    declare @id int

    set @id=3

    select col1 from dbo.test1 where col1=2

    return @id

    end

    then call it by:

    select...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Dynamic query in a function

    Hi Lowell

    I indeed missed your point. But when I tried as you told, I still can't make it working. I was able to create a funtion that starts with fn_...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

  • RE: Dynamic query in a function

    Well Jeff, I didn't ask if we can execute a dynamic sql from function, I asked if there is a work around for it. i knew there is no direct...

    Online Trainer For SQL DBA and Developer @RedBushTechnologies with 18 yrs exp.

Viewing 15 posts - 256 through 270 (of 326 total)