Forum Replies Created

Viewing 15 posts - 12,196 through 12,210 (of 13,460 total)

  • RE: Cannot drop temp table

    you want to drop only the tables that are related to your connection; your IF EXISTS statement checks accross all connections, so you could pick up a temp table from...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: datetime stamping for ModifiedDate and CreatedDate

    yeah, in order to have a changedDt column with the last Updated/changed, you'd need to add a trigger to the table. with the trigger, you'd be able to update the...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: datetime stamping for ModifiedDate and CreatedDate

    the timestamp datatype lets you know the last affected automatically, but it's not a datetime field;

    here's an example:

    create table #sample(somevalue varchar(30),CreatedDt datetime default getdate(),ChangedDt timestamp)

    insert into #sample(somevalue) values('value 1')

    insert into...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Destroyed databases with SQL 2005 Express

    i use this cursor below on our dev machine at work;

    it runs as a job twice a day, which is often enough to switch any new or newly restored databases...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: CASE with SELECT * FROM TableName not possible?!

    it's kinda straightforward i think; a case statement can return only one datatype.

    when the case is constructed, i think it is assuming the first item int he case statement will...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Foreign Key help!!

    AFTER YOU PRINT YOUR VARIABLE, I THINK YOU'LL SEE HTE MISSING OPEN PARENTHESIS FOR OBJECT_ID FUNCTION:

    parent_object_id = OBJECT_ID(' + @table + ')'

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Adding same foreign key to two columns

    when i reformatted your sql for readability, it was missing a couple of commas.

    this works:

    CREATE TABLE BATCHES_LOTS (

    [BATCHNO] varchar (15),

    [TRANSFERID] int,

    CONSTRAINT PK_BATCHES_LOT PRIMARY KEY (BATCHNO,TRANSFERID ))

    CREATE...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: loading data from Oracle

    i googled for "oracle epoch date" and found a lot of stuff.

    one of the more obvious selectiosn was where they took the datatime as a double, and subtracted it from...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Create trigger on update

    Andras's example of the trigger determining what changed is perfect...but you want to send the email outside of the trigger code, and not inside it.

    remember that a trigger needs to...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: CASE with SELECT * FROM TableName not possible?!

    the case statment is for a field, I think you thought you needed to identify the table and where for each case, and that's not true:

    this is syntactically correct:

    DECLARE @Ind...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: update archivedata base from active database

    here's how I do it as a scheduled job; i don't need instant updates via a trigger:

    --new records first

    INSERT INTO ARCHIVETABLE(list_of_Columns)

    SELECT list_of_Columns from ACTIVETABLE

    LEFT OUTER JOIN ARCHIVETABLE ON...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Set Query governor in a logon trigger

    SET QUERY_GOVERNOR_COST_LIMIT sets the limit for all commands in a batch, not at a connection or user level. so the limit was invoked during the life of the trigger execution,...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: VB script for checking whether server is running or shutdown

    there's so many levels you can check, it depends on what you want to do.

    For example:

    --you can ping a server via a script to see if DNS works/server exists on...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: T-SQL Set NOCOUNT On and Off

    the SET NOCOUNT ON command is to affect all of the subsequent commands in the batch you are running....

    if you were to set it off at the end of a...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

  • RE: Extract filename from fully qualified path

    yeah a double reverse will work here; i broke it into a couple of steps to make it a bit more obvious:

    declare @filename varchar(1000)

    set @filename = 'C:\Program Files\Microsoft SQL Server\MSSQL\BACKUP\MyFile.txt'

    select...

    Lowell


    --help us help you! If you post a question, make sure you include a CREATE TABLE... statement and INSERT INTO... statement into that table to give the volunteers here representative data. with your description of the problem, we can provide a tested, verifiable solution to your question! asking the question the right way gets you a tested answer the fastest way possible!

Viewing 15 posts - 12,196 through 12,210 (of 13,460 total)