Can a list of columns be used with this?

I'm curious if there is a way to pass in a list of column names and possibly table names too instead of just using one of each in the code below.  Thanks in advance for any help!
IF EXISTS(select * from sys.columns
where Name = N'myColumn' and Object_ID = Object_ID(N'myTable'))
begin
-- Column Exists
PRINT N'The column exists';
end
ELSE
-- Column doesn't exist
PRINT N'The column doesn''t exist';
GO

Hello "new to sql server"
Here is my suggestion for your requirement
declare @list as table (
tablename sysname,
columname sysname
insert into @list select N'Employee', 'first'
insert into @list select N'Employee', 'username'
insert into @list select N'Employee', 'last'
insert into @list select N'Countries', 'Code'
insert into @list select N'items', 'Id'
insert into @list select N'items', 'State'
insert into @list select N'Books', 'Author'
select
u.tablename,
case when t.object_id is null
then u.tablename + ' table does not exist'
else
case when c.object_id is null
then u.columname + ' column does not exist in table ' + u.tablename
else
u.columname + ' exists in table ' + u.tablename
end
end
from @list u
left join sys.tables t on u.tablename = t.name
left join sys.columns c on t.object_id = c.object_id and u.columname = c.name
Please note that on your SQL Server version sys.tables might be used as systables, and similar case for sys.columns table
 I hope this SELECT script can help you for the solution,
SQL Server, SQL Server 2012 Denali and T-SQL Tutorials

Similar Messages

  • Can any 3rd party sensors be used with this system?

    I have several wireless door sensors currently in use with my ADT system that I plan to cancel soon. Is there a way to use these with the gateway?
    Can any 3rd party IP camera be used with the gateway, or only the ones provided on your site?
    Supported or not, just wondering if theses items will work. Thanx ~

    Zwave is a Propiertary standard protocol.
    Both ADT And Verizon are offering us off the shelf zwave devices.
    So we "should" have been able to use any zwave devices.
    But no...
    it appears that Verizon has decided to lock out anything they haven't sold us directly
    (lock out from their gateway).

  • How can I change excel column header using Labile.

    Dear Experts,
                          How can i change excel column header using LabVIEW.
    Thanks for any and all help!
    M.S.Sivaraj.
    Sivaraj M.S
    CLD

    As I said in my previous post, column headers in Excel are merely row 1 cells. May be I missing something here, so please be more explicit with your question.
    I guess you are using the Excel Report tools, and you want to modify an existing sheet. From my limited experience with the Excel Report tools, it is not possible to open an existing woorkbook (except as template...), so the answer to your question should be "Forget it"...
    The work around is to use the example I pointed for you before, and either to write the whole new colum headers as a string array, starting in A1, or to write a single string to a given cell in row 1.
    Hope this helps 
    Chilly Charly    (aka CC)
             E-List Master - Kudos glutton - Press the yellow button on the left...        

  • How can we get Dynamic columns and data with RTF Templates in BI Publisher

    How can we get Dynamic columns and data with RTf Templates.
    My requirement is :
    create table xxinv_item_pei_taginfo(item_id number,
    Organization_id number,
    item varchar2(4000),
    record_type varchar2(4000),
    record_value CLOB,
    State varchar2(4000));
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'USES','fever','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'HOW TO USE','one tablet daily','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'SIDE EFFECTS','XYZ','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'DRUG INTERACTION','ABC','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'OVERDOSE','Go and see doctor','TX');
    insert into xxinv_item_pei_taginfo values( 493991 ,224, '1265-D30', 'NOTES','Take after meal','TX');
    select * from xxinv_item_pei_taginfo;
    Item id Org Id Item Record_type Record_value State
    493991     224     1265-D30     USES     fever     TX
    493991     224     1265-D30     HOW TO USE     one tablet daily     TX
    493991     224     1265-D30     SIDE EFFECTS     XYZ     TX
    493991     224     1265-D30     DRUG INTERACTION     ABC     TX
    493991     224     1265-D30     OVERDOSE      Go and see doctor     TX
    493991     224     1265-D30     NOTES     Take after meal     TX
    Above is my data
    I have to fetch the record_type from a lookup where I can have any of the record type, sometime USES, HOW TO USE, SIDE EFFECTS and sometimes some other set of record types
    In my report I have to get these record typpes as field name dynamically whichever is available in that lookup and record values against them.
    its a BI Publisher report.
    please suggest

    if you have data in db then you can create xml with needed structure
    and so you can create bip report
    do you have errors or .... ?

  • Can an Envy 7640 printer be used with a Google Chrome Operating system?

    Can an Envy 7640 printer be used with a Google Chrome Operating system?

    You are not going to find Chrome on the drop down list, there is no driver to install on chrome, as it doesn't support the concept of a device driver. The only way to print is using cloudprint.
    Cloudprint on a hp printer, means you get an email address for that printer by signing up for hp eprint.
    To sign up for hp eprint, simply touch the eprint icon on the printer's screen (that looks like a mobile device signaling a printer). This HP page has detailed steps: http://h10025.www1.hp.com/ewfrf/wc/document?cc=us&lc=en&docname=c04327805#N57
    ======================================================================================
    * I am an HP employee. *
    ** Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves your issue. **
    ***Click on White “Kudos” STAR to say thanks!***

  • I have a new Macbook pro and can't recall the password I used with my Time capsule - How can I (ideally) retrieve or possibly change the time capsule password?

    I have a new Macbook pro and can't recall the password I used with my Time capsule - How can I (ideally) retrieve or possibly change the time capsule password?

    Remember security on a TC is an illusion.
    Simply press the reset button for 1-2 sec.. you must not do too long .. it will then hard reset.. but soft reset will revert all passwords to default for 5min. ie TC password is now public.
    Remember this the next time because anybody at all can change your passwords.
    Once into the TC you can then open the view passwords if you wanted any weaker security. Click and open the TC.. and click on edit.. then go to the top menu..
    Voila .. all your passwords in plain sight to any Tom Dick and Fred.

  • HT201209 can the same gift card be used with a differencet itunes account?

    can the same gift card be used with a differencet itunes account?

    No, a gift card can only be redeemed onto one account - it can then only be used to buy items for that account (it can't be used to gift content to another account).

  • A certificate could not be found that can be used with this Extensible Authentication Protocol. (Error 798)

    Hi,
    I posted this on Azure forim with no luck maybe here is a better choise.
    When trying to connect a windows 8\8.1 client with a vpn connection for azure virtual network we get the fallowing error.
    "A certificate could not be found that can be used with this Extensible Authentication Protocol. (Error 798)"\
    I'm fallowing this msdn article about point to site vpn on azure. according to it the certificat is good for both win 7 and win 8.
    http://msdn.microsoft.com/en-us/library/azure/dn133792.aspx
    this is the commanf to build the client certificat:
    makecert.exe -n "CN=ClientCertificateName" -pe -sky exchange -m 96 -ss My -in "RootCertificateName" -is my -a sha1
    When runing the installtion of the certificat on the client the defult crtificate store is "Automatic", It does not metter if I leave it on Automatic or choose any of the other options (personal, trusted issuers ...) I always get the same error.
    Thanks

    Hi,
    Apologize to say that I am not familar with Azure and lack of the environment to investigate the issue here.
    Besides, please take a look at the below threads to see if it could help:
    Point-to-Site on Windows 8 Client
    connection Error 798
    Best regards
    Michael Shao
    TechNet Community Support

  • Can a Panasonic HD Camera be used with Adobe Flash Media Live Encoder 3.2

    Can a Panasonic HD Camera be used with Adobe Flash Media Live Encoder 3.2 instead of my Laptop webcam.

    yes it can but you need an in/out device to "link" the HDMI output from your HD camera to your computer via, USB or firewire
    BlacMagic sell those, Matrox and AJA are some of the other brands on the market.

  • Can the "Delivery Frequency Calendar" be used with Commodities?

    A customer has many Suppliers in China that have different calendars
    for observing Chinese New Year.
    They must account for these schedules to order in time, so they do not miss fulfilling sales orders.
    According to Note 175935.1 , it appears that the ASL needs to be assigned to items.
    However; they are using a global ASL rule for a commodity instead of an item.
    Test Case:
    Create a "Delivery Frequency Calendar" a "Build"
    Add the calendar to the ASL
    Run MRP and see that the planned order has a dock date inside of the days
    specified as "off".
    Can the "Delivery Frequency Calendar" be used with Commodities?
    If so, how does one set this up?
    Thanks in advance.

    The customer explains the following:
    Organization Code = APP (Organization_id = 124)
    Part Number = 0328078 (Inventory_item_id = 102991)
    Item 0328078 exists in Organization APP
    Lead Times Preprocessing Lead Time 1 Org
    Lead Times Cumulative Total Lead Time ~ Org
    Lead Times Variable Lead Time ~ Org
    Lead Times Lead Time Lot Size 1 Master
    Lead Times Fixed Lead Time ~ Org
    Lead Times Cum Manufacturing Lead Time ~ Org
    Lead Times Processing Lead Time 65 Org
    Lead Times Postprocessing Lead Time 3 Org
    MRCNEW debug log file with the Inventory_item_id = 102991 details:
    https://gtcr.oracle.com/gtcr-dir/gtcr_106036848/6564940.993/MBPlanner_2nd_run.req</font>
    Please review the file 0328078_Setup.doc and the Supply Chain Planning report.
    So, support researched the issue more and came up with:
    Note.466300.1 "Organization Based Commodity Sourcing Rule Not Being Considered During Checkout"
    Note.466220.1 "How Does The Commodity Based Sourcing Work For Internal Requisitions?"
    However; the customer responded with:
    "We release out of the planners workbench, as well as purchase release drop
    ship S.O.s out of OM, and the P.O. is automatically created correctly to
    the correct Supplier/Site based on our S.R., A.S.L., and quotations.
    Doesn't that indicate it is finding and using the S.R., A.S.L., and
    quotations?"
    Subsequently, support located using Autodiagnose "MRP commodity sourcing
    dock date":
    1 TAR: 4441533.992 HOW TO SETUP AND USE DELIVERY FREQUENCY CALENDARS 719 11.5.10
    http://webiv.oraclecorp.com/cgi-bin/webiv/do.pl/Get?WwwID=<A TARGET="_BLANK" HREF="DWB_ITS_API.SHOW_TAR?P_TAR_NUMBER=4441533.992">TAR:4441533.992
    2 TAR: 4361672.996 PLANNING CONSTRAINT NOT CONSIDERING BY SUPPLY CHAIN MRP FOR ASL BY COMMODITY 574 11.5.9
    http://webiv.oraclecorp.com/cgi-bin/webiv/do.pl/Get?WwwID=<A TARGET="_BLANK" HREF="DWB_ITS_API.SHOW_TAR?P_TAR_NUMBER=4361672.996">TAR:4361672.996
    The current functionality in MRP does not consider planning constraint setup in ASL by commodity at this time.
    Can BDE contact development to confirm if this is supposed to work at all?

  • Can the usb camera converter be used with a flash drive or scaning device?

    can the usb camera converter be used with a flash drive or scaning device?

    No.
    iOS does not have scanner drivers nor does the connector supply enough power.
    Flash drive would kind of work, would need to have a DCIM folder-probably wouldn't see whole drive(?)
    Then again this exists, uses wifi:
    http://i.tuaw.com/2011/05/16/goflex-satellite-is-your-ipads-portable-wireless-ha rd-drive/

  • Can Waves audio plug-ins be used with Premiere Pro CC?

    Hi folks,
    As it says in the thread title, can Waves audio plug-ins be used with Premiere Pro CC?
    Cheers!

    I dont think so:
    http://www.adobe.com/products/premiere/extend.displayTab4.html
    http://www.waves.com/support/tech-specs/supported-hosts

  • A certificate could not be found that can be used with this extensible authentication protocol in PEAP policy config

    Windows 2003 enterprise
    AD DC, DNS, DHCP, CA and IAS all are running from single server. But at the time of configuration of Remote Access Policy the error message of "a certificate could not be found that can be used with this extensible authentication protocol" is appeared.
    So with the help of mmc snap in the certificate was requested from CA (Domain Controller template)as a new certificate request and placed in the local computer personal folder. 
    After placing the certificate the error message was disappeared during configuring PEAP. 
    But after sometime the certificate was disappeared from remote access policy. But the same imported certificate was present in personal folder.
    What is reason for frequent disappearing?
    How to manage the situation?

    Hi,
    I think the cause is that the DomainControllerAuthentication certificate has superseded the
    DomainController certificate which is chosen during the setup of IAS.
    To avoid this, if you’re going to install IAS on a Domain Controller, the DC should be made to enroll for a separate certificate from the template
    'RAS and IAS Servers' before the IAS server is installed and this certificate should then be chosen for any PEAP setup.
    Further details:
    Enrolling Certificates with Templates
    http://technet.microsoft.com/en-us/library/dd197527(v=WS.10).aspx
    Configure the server certificate template
    http://technet.microsoft.com/en-us/library/cc755043(v=WS.10).aspx
    Steven Lee
    TechNet Community Support

  • Can anyone recommend powered speakers to use with Airtunes ?

    Can anyone recommend powered speakers to use with Airtunes ? I live in Toronto and I cant seem to find any too easily.
    Thanks

    John Galt wrote:
    Apple used to sell the Apple Hi-Fi which I thought complimented the Express nicely.
    They're both white -- I'll give you that.
    What I was thinking of more when I said similar in design was the way that the AirPort Express simply hangs on a wall, no desk or shelf shape required, with the bare minimum of cables. By the same token, I'd like to have a small amp and/or speakers that could hang/be mounted on the wall and deliver music into the room via AirTunes -- without an octopus of cables and without having to dedicate an entire tabletop to it (audio should be heard and not seen.)
    Well, that would be great, but there are way too many variations of audio equipment for people with all kinds of tastes to make for a worthwhile market. Whereas I might think it's silly to have more than a 100W stereo amp others would consider that pathetic.
    If Apple could pack a 100W+ amp into something that hangs off a power outlet, more power to them. I was thinking more along the lines of 5-10W, or just enough to power some wall mounted speakers. That said, [these speakers|http://store.apple.com/us/product/TU902VC/A?fnode=MTY1NDA1NA&mco=Mjc4M jI1MQ] look somewhat promising. It looks like they could be powered off the USB on the AEX, so at least no power brick. Unfortunately, they don't look geared to wall mounting, and who knows what the audio cable connections look like (because the ad deceptively photoshopped them out of the picture.)
    The Express's low power analog output, plus optical, not to mention an Ethernet port, router, bridge, a/b/g/n wireless access point and USB printer port in such a tiny package with a self-contained power supply is a such a generalist's piece of connectivity I can't imagine asking for anything more.
    It is a pretty impressive package. But, I'm still asking for GigE in the next rev.

  • Can PowerPC applications be converted for use with Lion OSX? If so, how?

    Can PowerPC applications be converted for use with Lion OSX? Ifso, how?

    Three workarounds:
    1.  If your Mac supports it, partition your internal hard drive or use an external drive and install Snow Leopard.  Then you can "dual-boot" into Snow Leopard when you want to run your PowerPC applications.
    2.  Upgrade and/or find alternative replacements for your PPC software that run without Rosetta.
    3.  Install Snow Leopard (with Rosetta) into Parallels 7 in Lion:
                             [click on images to enlarge]
    Or in Mountain Lion:
    Full Snow Leopard installation instructions into Parallels 7 are here:
    http://forums.macrumors.com/showthread.php?t=1365439

Maybe you are looking for