Forum Replies Created

Viewing 15 posts - 9,226 through 9,240 (of 13,461 total)

  • RE: SQL 2005 find all users in a DB role

    i have this saved in part of my snippets; it's scripting all the users for every role ; you could parameterize it to limit it to one role if desired:

    --example...

  • RE: Selecting date before 6 months

    in TSQL, you'll want to use the DATADD function. when you add a negative number, it subtracts it from the date: you can use it to add or subtract any...

  • RE: Missing Surface Area Configuration in SQL Server 2008

    it's been removed as a separate executable, and is all the pieces are moved around a bit, but are accessible in part of SSMS:

    http://www.mssqltips.com/tip.asp?tip=1673

  • RE: SysObjects and differing tables not based on name

    ok try this as a proof of concept: in your Sandbox, do a Select * into newtable from sometable, and then run this query:

    i'm using FORXML to concat all the...

  • RE: Send Email using OPEN QUERY

    well syntactically, i think this is correct, but it's untested:

    SELECT * FROM OPENQUERY( [linked server],'SET FMTONLY OFF; EXEC (''declare @body1 varchar(4000)

    set @body1 = ''New Website Product as of '' +...

  • RE: Query tunning

    it might also be parameter sniffing; if you have parameters with default values on them, a query plan is probably built assuming the default value (ie myproc(@The date datetime =...

  • RE: Carriage return in xp_sendmail

    Set @Job = '<HTML>The following opportunity has been changed to ' + @Stage + ': '

    + '<br />'

    +'Subject: '+ @Subject

    + '<br />'

    +'Project Number: '+ @ProjectNumber

    + '<br...

  • RE: Remove DBCC Permissions

    DBCC SHRINKFILE is granted to the roles sysadmin and db_owner

    to remove permissions from a user, you'd most likely take away the db_owner role from them.

    there is no other way...

  • RE: Help with a query....

    it might be more clear if it looked like this...the zero is the first date in SQL:

    select DATEADD(wk, DATEDIFF(wk,'19000101 00:00:00.000',getdate()), '19000101 00:00:00.000')

    --is the same as

    select DATEADD(wk, DATEDIFF(wk,0,getdate()), '19000101 00:00:00.000')

    --is the...

  • RE: Help with a query....

    Dan this is one of the coolest things to use once you get your head wrapped around it.

    if you select DATEDIFF(wk,0,getdate())

    this will return week '5763' , which is the #...

  • RE: Help with a query....

    you can use the DATEADD and DATEDIFF function to determine the monday of the current week.

    --Monday of the Current Week

    select DATEADD(wk, DATEDIFF(wk,0,getdate()), 0)

    so you want to avoid converting a datetime...

  • RE: isnumeric issue

    Steve i made an ITVF based on your example, but i added a bit more to it;

    i was thinking if i allow periods in the data, i need to check...

  • RE: DLL OR OCX??

    you probably heard wrong, i think.

    a SSRSreport is saved to a .rdl file(RDL=report definition language?), which is xml for the report's structure,design,location of all it's objects, etc.

    that is what your...

  • RE: Use Database statement not working in an EXEC statement

    calvo's example is exactly correct, i think; the EXEC() statement is stand alone, and does not affect the session/window it is a part of.

    so to do what you want, you...

  • RE: Duplicate records in the table

    this will give you the results featuring row_number(); use the inner portion of the query to see the raw results, the outer query returns just the duplicate items:

    productname,colorcode,categoryname,brandname,colorname

    SELECT * FROM...

Viewing 15 posts - 9,226 through 9,240 (of 13,461 total)