Forum Replies Created

Viewing 15 posts - 1,141 through 1,155 (of 13,460 total)

  • RE: How do I add 2 computed columns

    compulted columns are simply ADD NAME AS {some calculation } [PERSISTED] if you wantthe row values rendered and stored instead of calculated on demand

    ALTER TABLE [PIHP].[HIST5657]

    ADD

    ServiceFromDatex AS CONVERT(CHAR(8),ServiceFromDate,112 )...

    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: Trying to create EMAIL formatted HTML with T-SQL

    you assigned your string to @table, but did not append it to @html;

    add SET @html = @html + @table + @tail before you do the email;

    you need a @tail...

    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: Restrict DB Access - Permit Query Execution

    create a view that contains the query.

    create a user, and grant the user access only to that single view.

    as long as the query hits a single schema(ie dbo) in 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: SQL Backup path change from Local to Network

    best practice is still to use a local drive.

    that's the only drives you can consitently depend on exisitng, right?

    After creating the backup, you would want to compress the file...

    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: SQL mail html table formatting in Outlook

    for xml won't let you inject closing html tags any place you want, but what you want to do is make it do the 99% of the work, and then...

    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: Function that concatenate for multiple types and evaluates field length

    not sure why you might limit yourself to 150 chars; database mail, outlook, email clients do not have a limitation like that.

    i'm just selecting emails via FOR XML to make...

    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: SQL mail html table formatting in Outlook

    you've got quite a few things going that are causing malformed html; IE will do it's best to clean that up, but Outlook does not.

    i populated your table and reviewed...

    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: COMMA WITHIN NAME FIELD CAUSING COMMA-DELIMITED FILE IMPORT ERROR

    is your data double quoted, meaning the value featuring the comma is properly delimited so you can process it?

    1,Academy award winners,"Jones, James Earl",moredata

    if it's not, you need to go...

    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: finding store proces that need to be recompiled

    if we are talking about checking if an object is no longer valid because columns or tables were renamed , dropped, etc,

    i've got this script i posted here on SSC...

    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: sp_send_dbmail sending duplicate emails to user

    i've seen the same on my side, with the default of one retry; an email with to: 'goodemail@somedomain.com;bademaul@somedomain.com' results in goodemail getting two emails.

    first thing to do is review who...

    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 sort columns.

    i would think youll start with a case expression, and then order by the tagname anyway as the second condition;

    how do you get the value "tagor1", for example? uis 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: What is the best to remove xp_cmdshell calls from t-sql code

    i leave xp_cmdshell disabled by default , and have processes enable it, perform bcp via xp_cmdshell, and then disable again.

    you could perform bcp from a command line SQL job, 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: Creating a Dynamic Temp Table

    how about not using #temp, but creating the table in tempdb instead? then it will still exist.

    DECLARE @cmd nvarchar(4000) = '

    SELECT schema_name(schema_id) As Schemaname,

    object_id,

    Name as TableName

    INTO tempdb.dbo.StagingTable

    from msdb.sys.tables...

    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: Send Multiple query results as multiple csv files in a single email

    SQL!$@w$0ME (4/1/2016)


    Thanks Lowell. Can you please provide the code for 'CLR_ExportQueryToCSV'.

    below is an updated version of it, i posted the original version of it on http://sqlclrexport.codeplex.com/ years ago.

    SQLCLRExport.zip

    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: Oracle BETWEEN DateTime statement

    you posted in "working with oracle", so i thought you were using oracle.

    if this is SQL server, then you would just stick with dateformats that are universally converted;

    you said you...

    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 - 1,141 through 1,155 (of 13,460 total)