Forum Replies Created

Viewing 15 posts - 2,011 through 2,025 (of 13,460 total)

  • RE: Want to create random alphanumeric characters for primary key values

    carrieathomer (2/11/2015)


    for a new project

    i need to create random alphanumeric characters as primary key values when inserting a record.

    eg: cmSbXsFE3l8

    it can start from 4 digit characters and can grow 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: Linked server sal server 2008 r2 with mysql works with select but not with insert into

    openquery is not an obbject you can insert into. its a command that can RETURN a table like structure, but not insert into one.

    i think you can use a four...

    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: How to temporarily block a table from user access ?

    start a transaction with tablockX? that would lock everyone out, right?

    begin tran

    select * from MyPrimaryTable with (tablockX) WHERE 1 = 2

    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: To find any SQL server proc, in a specific database that is returning more than N rows

    you could query the dmv's and shred the xml of the actual execution plans and get the actual number of rows returned for anything still in cache.

    after that, it gets...

    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: Get rid of MAX function

    educated guess, since the all those values dates of arrivals are tied to the ship itself, it's not appropriate to arbitrarily grab the max.

    you need to use row number...

    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: GET 1 RECORD WHERE STARTDATES ARE IDENTICAL

    must be missing something int he question... you can limit the results by using top, but top should have an order by; do you want the first member, last member,...

    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: Need to load 4 different csv files into 4 diffrent tables using t sql in one sql can't use ssis

    a quick example adapted form my snippets:

    declare @filename varchar(255),

    @path varchar(255),

    @sql...

    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: Need to load 4 different csv files into 4 diffrent tables using t sql in one sql can't use ssis

    so, what is the pattern then? any file that ends in [_A.csv] goes into the [A] table, for example?

    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: Need to load 4 different csv files into 4 diffrent tables using t sql in one sql can't use ssis

    well, what is the pattern that you can use to find the file/filepath if it's dynamic? is it int he same folder + different file name?

    you can use xp_cmdshell...

    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: Audit table help to compare and find difference (COMPARE)

    if you want to find the changes, no matter what they were, and not on a specific field use this:

    /*--results

    ItemNumber Item ItemNumber Item seq_no

    44 ...

    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: Audit table help to compare and find difference (COMPARE)

    neat problem.

    find the DelimitedSplit8k function here, and it's a peice of cake.

    the set up for testing:

    CREATE TABLE [#co_audit_trail](

    [seq_no] [bigint] IDENTITY(1,1) NOT NULL,

    [create_complete] [tinyint] NULL,

    [user_name] [varchar](60) NULL,

    [db_event] [varchar](16) NULL,

    [date_of_change] [datetime] NULL,

    [time_of_change]...

    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: Slow Queries with Linked Server sql 2012

    ahh, the pain of linked servers.

    linked servers don't belong in views; i'd consider finding out how much wiggle room you have on latency, and pull the data from the linked...

    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: Weird behavior comparing two float columns in SQL 2012

    check how your calculations are performed,and see if there could be integer division involved!

    in SQL, an integer divided by an integer is an integer, that ramification means truncation .

    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!

  • RE: Deleting Job history for particular time period

    like this, i think?

    with MyCTE

    AS

    (

    with MyCTE

    AS

    (

    select row_number() over(

    partition by Job_ID,run_date,step_id

    order by run_date desc,run_time desc,step_id) As RW,

    * from msdb.dbo.sysjobhistory

    )

    delete FROM MyCTE WHERE RW >1

    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 add a server login to multiple databases

    the users themselves are contained in the databases themselves,

    if you are migrating, maybe you mean migrating logins to a new server via the ms proc sp_help_revlogins?

    for an existing instance,...

    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 - 2,011 through 2,025 (of 13,460 total)