Forum Replies Created

Viewing 15 posts - 12,406 through 12,420 (of 13,460 total)

  • RE: QUERY TO ADD RECORDS TO A TABLE

    typically, to insert multiple rows, you use a select statement to insert the data.

    a simple example might be:

    INSERT INTO SOMETABLE(ID,NOTES)

    SELECT

    CustomerId,

    'This is a default note that...

    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: Backup Strategy

    sometimes it's easier to change something that exists, than to create something from scratch.

    I would suggest just creating a default maintenance plan using Enterprise Manager to make a backup plan and...

    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: Script to compare two tables

    Vladan's right, you MUST be able to identify what makes a row "unique"; it may be a combination of 5 fields, or it may be every field. that is 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: Insert one row in one table and multiple rows on a second table inside transaction

    it sounds like you are entering some master...detail information into a pair of tables;

    As Vladan identified, you should be doing this as a couple of set based operations, instead of...

    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: Insert one row in one table and multiple rows on a second table inside transaction

    the more details you can provide, the better the answer.

    here's an example, but I'm not sure how helpful this will be:

    Create Procedure PR_Sample(@somedata varchar(30),@moredata varchar(30) )

    As

    Begin

    SET XACT_ABORT ON

    BEGIN TRAN  ...

    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: High sal from table

    you use a technique using the TOP statement twice:

    declare @payroll TABLE (

    salary money,

    firstname varchar(30) )

    INSERT INTO @payroll(salary,firstname)

    SELECT 400.01,'Bob' UNION

    SELECT 800.02,'Bill' UNION

    SELECT 1200.03,'Todd' UNION

    SELECT 100.01,'Nick'

    SELECT TOP 1 X.salary,X.firstname  FROM (

    SELECT TOP...

    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: select statement help

    something like this?

    SELECT DISTINCT categories FROM sometable ORDER BY categories

    will give you the list you described;

    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: txt file importing

    sorry, i cant seem to see how you know which column is which;there's no obvious pattern in the sample you rpovided.

    If you could determine that column 3 was always an...

    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: Stored Proc help, prevent insert.

    it's easier than you thought.

    several ways.

    add a constraint to the table where UserID <> @InvitedUserid.

    Use the If example below.

    ALTER

    PROCEDURE [dbo]

    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: find data type of a field in a select

    this is one of those situations where the client side would have more functionality than server side.

    once placed in an ADODB recordset, the recordset has the datatype and defined size...

    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: Date, Sum and SQL recursive

    the above also would not take into consideration if there were 3 or more rows that should condense to a single time slot you'd need to handle it differently, most...

    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: smart headers

    you gotta try what i posted: you end up with a 15 character string with the preceeding zeros you requested.

    SELECT RIGHT('000000000000000' + CONVERT(VARCHAR,1),15)

    SELECT RIGHT('000000000000000' + CONVERT(VARCHAR,86456),15)

    SELECT RIGHT('000000000000000'...

    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: DB Permissions

    you want to change all the objects back to smdb;

    --find everything NOT owned by dbo, and create the sqls to change them to dbo as owner:

    select 'EXEC sp_changeobjectowner...

    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: Scalar UDF and dynamic sql - alternatives?

    it really depends on what your UDF is doing;

    we need that code to determine whether this can be done cleaner; the more real details you post, the better we...

    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: txt file importing

    when you say the columns are not in the same order, what do you mean? is the data in name:value pairs, like 'fruit:apple;vegetable:peas and carrots;'

    could you post a couple of...

    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,406 through 12,420 (of 13,460 total)