Forum Replies Created

Viewing 15 posts - 46 through 60 (of 62 total)

  • RE: Need SQL Script

    Try this one:

    select o.name as sp_name,

    (len(c.text) - len(replace(c.text, char(10),''))) as lines_of_code,

    case when o.xtype = 'P' then 'Stored Procedure'

    when o.xtype in ('FN', 'IF', 'TF') then 'Function'

    end as type_desc

    from sysobjects o

    inner join...

  • RE: Script to Add User to all Databases

    This script will add the user to each DB, but you must have the Login created first.

    It will add the user as a db_datareader role.

    sp_msforeachdb 'use [?]; CREATE USER [MyDBUser]...

  • RE: Deleting Inactive login

    Hi,

    First, you must make sure that you have [Login Auditing] turned at least for "Successful logins".

    If you do not, then run the script below to turn it for for "Both...

  • RE: best approach to have a job on sql 2005 update sql 2008 server

    Follow these steps and you will accomplish what you need:

    Step 1)

    USE master

    GO

    --Create a Linked server on the SQL 2005 that points to the SQL 2008'

    EXEC master.dbo.sp_addlinkedserver @server = N'SQLSERVER2008',

    ...

  • RE: Need SQL Script

    If you are using SQL Server 2000 here are some views and tables you can query:

    SELECT * FROM sysindexes

    SELECT * FROM INFORMATION_SCHEMA.tables

    SELECT * FROM INFORMATION_SCHEMA.VIEWS

    You can also use the [sysobjects]...

  • RE: How to display the database property

    You should use the sp_helpdb Stored Procedure

    you can pass parameters if you want a specific databases.

    i.e. sp_helpdb 'master'

  • RE: virtual server migration

    We have done that in the past and to be honest, there are a lot of things you have to do.

    I do not remember the exact list of steps, but...

  • RE: DB Schema version Info

    You can use the sp_helpdb stored procedure or query the sys.databases system table

    sp_helpdb 'master'

    GO

    SELECT * FROM sys.databases WHERE name ='master'

    GO

  • RE: ISNULL on Empty Set

    IsNull function only replaces data where the value is null, but it does not handle when there is no data.

    For that you need something like this:

    IF NOT EXISTS ( SELECT...

  • RE: Query AD for Group Membership

    Try this code,

    I use it to list of the members of a specific AD group or distribution list.

    You can modify to display the fields you want.

    EXEC master.dbo.sp_addlinkedserver @server = N'ADSI',

    ...

  • RE: Need advice on returning data based on specific day and time ranges

    The function "DAY" will return the day of the month, not the weekday. This will not help you determine whether the day is Monday or Thursday, etc.

    You have you use...

  • RE: WHERE Clause in Views

    A view is a select statement from one or many tables.

    When you query the view, the SQL Query optimizer chooses the best execution plan based on the least cost.

    So, if...

  • RE: Moving a standalone database server to a windows 2008 clustered environment

    Hi mashikoo,

    First and foremost, you cannot convert a stand alone instance into a cluster one.

    Here is my recommendation:

    1) Backup your databases and take SQL Server offline

    2) Make sure that you...

  • RE: Need Hiarachy of date

    Hi,

    You can simply create a loop that can iterate through all the different dates.

    You can find more documentation on MS website. http://msdn.microsoft.com/en-us/library/ms178642.aspx

    Please let me know if that works for you.

    DECLARE...

  • RE: Update the column included in Combined Unique Index

    Hi Grace,

    It does not matter that your unique index is a combination of many columns,

    you can update any of the columns as long as your update does not violate the...

Viewing 15 posts - 46 through 60 (of 62 total)