Forum Replies Created

Viewing 15 posts - 9,406 through 9,420 (of 13,461 total)

  • RE: I want to get the alert message when the sqlserver restarted.

    you can create a job that starts when the sql agent starts; it's one of the options, after you create the job, to determine the schedule....there is a selection for...

  • RE: Get User Name from suser_name() and host_name()

    i think this is what you might be after:

    --results:

    TheDomainTheUser

    TheDomainlowell

    declare @MyDomainLogin varchar(30)

    SET @MyDomainLogin='TheDomain\lowell'

    --SET @MyDomainlogin = SUSER_NAME()

    SELECT

    --the -1 and +1 are to remov ethe char '\' itself fromt eh results

    SUBSTRING(@MyDomainLogin,1, CHARINDEX('\',@MyDomainLogin)...

  • RE: Adding multiple records to one line

    great marty! glad it's working for you!

    that FOR XML is great for concatenating, and the Tally Split is perfect for the opposite...getting a delimited list into rows.

    Those two things...

  • RE: date fuction

    multiply or add?

    the DATEADD function can accept your start date and add x number of months to it to give you that future date, is that what you want?

    select DATEADD(mm,14,'20090701...

  • RE: Accounts that don't have prior transactions

    --results

    Acct TransDesc Date ...

  • RE: Is this a bug in Log Shipping?

    no problem;the file name is being created with the UTC time (greenwich), so you must be in the US EST time zone to be -5 hours;

    the times inside the backup...

  • RE: Adding multiple records to one line

    i think you'll need a FOR XML to concat the colleges;

    here's an example, i would have adapted it to your data if you included the CREATE TABLE and INSERT...

  • RE: Simple Update using three tables. . .

    Donato this is how i usually update a table from multiple sources...note the commented SELECT statement so i can run the bottom portion to test before and after:

    SET XACT_ABORT ON

    BEGIN...

  • RE: DBCC linked server

    i have this in my snippets as teh way to run DBCC commands on linked servers:

    SELECT * FROM OPENQUERY( [linked server],'SET FMTONLY OFF; EXEC (''USE DATABASE; DBCC showfilestats WITH NO_INFOMSGS...

  • RE: bulk insert error

    i've seen this when the file you are processing comes from a unix type source...instead of slash-n for the row terminator, which looks for CHAR(13) + CHAR(10), try changing your...

  • RE: select into takes forever from remote server.

    linked servers are slow.

    usually a SELECT from a linked server, if it is joining on a local table, will copy the ENTIRE table from the linked server into your local...

  • RE: Why calculated fields?

    i most often add a persisted calculated field for indexing purposes.

    I've used it to pull out a substring from a field which is often searched, as well as dates with...

  • RE: LOGINS - Who Created it and When

    some powerful thread pruning occurred;

    i had posted the following and then reported them to the SSC gods:

    i'm thinking that chinnu.saha and pinky.bd420 are bots that are just designed to...

  • RE: Use generated identity for another column within the same insert

    still not so bad, but the same solution: the end users will have to enter/select the prefix and suffix, which could even have defaults on them, that's all:

    CREATE TABLE EXAMPLE(

    id...

  • RE: Use generated identity for another column within the same insert

    one easy way is instead of allowing a vlaue to be entered for your PONumber, make it a calcualted column instead:

    CREATE TABLE Example(

    ID int identity(1,1) primary key,

    PONumber AS 'SomePrefix' +...

Viewing 15 posts - 9,406 through 9,420 (of 13,461 total)