Forum Replies Created

Viewing 15 posts - 1 through 15 (of 22 total)

  • RE: Date Format

    Thank you - After your direction I re-analysed the query and spotted a CONVERT statement with varchar.  Changed from varchar to date and time respectively and this worked for the...

  • RE: Prompt For Choice

    Hi,

    When the code is executed no results appear. Am I on the correct lines or completely wrong ?

  • RE: SSMS Standard Reports Permissions - how to allow devs to view those?

    Hi,

    I have been working on a similar peice of work. The minimum permissions I had to provide and this did only show part of the report as sys.traces will...

  • RE: For Each - Remove-Item

    I tested the $_[0] within the Remove_item and it worked. Can you explain what the [0] does?

    Thank you for your time. Much appreciated.

    [String] $inventoryinstance="MyInstance"

    [String] $inventorydatabase="DBA_DB"

    #add-pssnapin sqlserverprovidersnapin100

    #add-pssnapin sqlservercmdletsnapin100

    $smoAssembly =...

  • RE: For Each - Remove-Item

    When I run the $._GetType() the following is returned: System.Data.DataRow

  • RE: For Each - Remove-Item

    I am using the code as you suggested but I cant seem to get the Remove-Item code to work.

    When I run the second line of code the output is what...

  • RE: For Each - Remove-Item

    I am actively trying to work on this function.

    I have slightly altered my code but now I am getting an error:

    [String] $inventoryinstance="MyInstance"

    [String] $inventorydatabase="DBA_DB"

    #add-pssnapin sqlserverprovidersnapin100

    #add-pssnapin sqlservercmdletsnapin100

    $smoAssembly = [reflection.assembly]::LoadWithPartialName("Microsoft.SqlServer.Smo")

    if (!($smoVersion))

    { Set-Variable -name...

  • RE: Dynamically Set Database

    This is what I am running which is failing:

    DECLARE @Counter INT = 1,

    @Command NVARCHAR (255),

    @DatabaseName NVARCHAR(255)

    DECLARE @test-2 TABLE

    (

    ID INT IDENTITY(1,1) NOT NULL,

    DBName NVARCHAR(255) NOT NULL

    );

    INSERT INTO @test-2 (DBName)

    select DISTINCT substring([name],1,patindex('%2%',[name])-2) [Name] FROM master.sys.databases WHERE...

  • RE: Dynamically Set Database

    Hi,

    This is the query I am trying to run:

    SELECT

    s.[Name],

    COUNT(DISTINCT s.[SessionId]) AS [SessionCount],

    SUM(DATALENGTH(rd.[TermData])) AS [TotalSessionSize]

    FROM [Session] s

    INNER JOIN [RawData] rd

    ON s.[SessionId] = rd.[SessionId]

    GROUP BY s.[Name]

    ORDER BY [TotalSessionSize] DESC

  • RE: Dynamically Set Database

    The first reply is exactly what I need but instead of using a simple select which works I am trying the code with a GROUP BY function and its throwing...

  • RE: Dynamically Set Database

    This worked perfectly.

    Thank you.

  • RE: Passing Variables

    you my friend are a hero!

    For some reason I couldn't get my head around it.

    Thank you.

  • RE: PowerShell - Get Permissions

    Can anyone help with my previous comment?

    I need to be able to loop around each of the directories above to get the folder permissions. (cacls)

  • RE: PowerShell - Get Permissions

    Hello,

    Sorry for the (very) late response I have been away. I have gone down a different road and I am currently stuck with this at the moment:

    [String] $inventoryinstance="Server\Instance"

    [String] $inventorydatabase="Database"

    $smoAssembly...

  • RE: PowerShell - Get Permissions

    Thanks for the responses. I am unsure how to loop through each database to get the data file location. Any help on this would be appriciated.

    I would like...

Viewing 15 posts - 1 through 15 (of 22 total)