Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Search results for query: *

  • Users: yorge
  • Order by date
  1. yorge

    Insert rows using CTE

    Hi Guys, Given sample tables below: CREATE TABLE [dbo].[TBL1]( [ID] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY, [ITEM_CODE] [varchar](20) NOT NULL, [CREATED_DATETIME] [datetime] NOT NULL ); CREATE TABLE [dbo].[TBL2]( [ID] [int] IDENTITY(1,1) NOT NULL PRIMARY KEY, [TBL1ID] [int] NOT NULL...
  2. yorge

    Passing DBNAME as stored procedure parameter

    Hi Guys, Is there anyway to pass the database name as parameter to a stored procedure? Kindly refer to the script below. Parameter @chk_db will contain the DB name to use. TIA, Yorge create procedure check_tbl @chk_db nvarchar(50) as begin -- Create if exist. Create if not found. if not...
  3. yorge

    Update a column with random value

    Hi Guys, Anybody can suggest a query to update all rows randomly of a given table say MYTABLE.MYCOL of CHAR(1) data type with value of either 'X' or 'Y' only? Thanks, Yorge
  4. yorge

    Update/Delete duplicate rows

    thank you so much gmmastros and johnherman
  5. yorge

    Update/Delete duplicate rows

    Hi Guys, Using CTE, WITH CTE AS ( SELECT ID,ANIMALGROUPID,TYPE,TAGID, ROW_NUMBER() OVER(PARTITION BY TYPE ORDER BY TYPE) AS DuplicateCount FROM PET ) DELETE FROM CTE WHERE DuplicateCount > 1 GO I can get this result: ID ANIMALGROUPID TYPE TAGID...
  6. yorge

    Update/Delete duplicate rows

    Hi johnherman, It didn't work. Also aside from removing the duplicates on PET table, there's also a need to UPDATE the PETOWNER.PETID as specified above. Anybody can please help? Yorge
  7. yorge

    Update/Delete duplicate rows

    Hi Guys, Given the rows on PETOWNER table ID PETID OWNER =================================== 1 1 Joe 2 2 Jane 3 3 Joey 4 4 Roy 5 3 Rey 6 6 James 7 5 Jet =================================== Given the rows on PET table ID ANIMALGROUPID TYPE TAGID...
  8. yorge

    Not Sure If this is a grouping question

    Hi Guys, Given the sample table below: ID X Y ----------------------- 1 25 24 2 24 25 3 75 1 4 9 10 5 10 9 ----------------------- I wanted a result like this: ID X Y...
  9. yorge

    List of all SPs and functions on a given DB

    tnx anyway, I hope somebody can give me some inputs...
  10. yorge

    List of all SPs and functions on a given DB

    thanks djj55, would like to ask you if you know how to extend this to just filter out SPs and functions that are uncontained entity in a contained database. Im using mssql 2012. Same idea, filter out uncontained SPs or functions which are NOT using temp tables with # notation.
  11. yorge

    List of all SPs and functions on a given DB

    just to add, this will be use for a contained database purpose. What is needed actually is a list of uncontained SPs or functions which are NOT using temp tables with # notation.
  12. yorge

    List of all SPs and functions on a given DB

    Hi Guys, Can anybody suggest a query that will lists all SPs and functions which is NOT using temp tables with # notation? Thanks, Yorge
  13. yorge

    Contained Databases with AlwaysOn Availability Group running on MSSQL 2012

    Hi Guys, Just want to ask if any of you have a good tutorial (steps) link on the implementation of contained databases with AlwaysOn Availability Group. We have an existing DB and we want it to be converted to a contained database which will be part of a AlwaysOn Availability group. Thanks...
  14. yorge

    Contained Databases with AlwaysOn Availability SQL 2012

    Hi Guys, Just want to ask if any of you have a good tutorial (steps) link on the implementation of contained databases with AlwaysOn Availability Group. We have an existing DB and we want it to be converted to a contained database which will be part of a AlwaysOn Availability group. Thanks in...
  15. yorge

    Automatically start a DB when linux server is restarted/rebooted.

    Hi Guys, I'm using both oracle 11g/12c. Would like to ask if there's a way an oracle DB (and listener) can automatically be started whenever a Linux server is rebooted/restarted. Would gladly appreciate some steps and few sample code to do this if this is possible. Thanks, Yorge
  16. yorge

    Return unique row from a given set of rows

    oops...sorry, I can't seem to align property the columns...but it should be CODE, CODESET, LANGUAGE, NAME and ORDER (5 columns)
  17. yorge

    Return unique row from a given set of rows

    Hi Guys, Given the sample data on a table: CODE CODESET LANGUAGE NAME ORDER ---------------------------------------------------------------------------------------------- PA_KNOWN FLAG_KNOWN ENG Known 10 PA_KNOWN FLAG_KNOWN NOB Kjent 10 PA_UNKNOWN FLAG_KNOWN...
  18. yorge

    Delete/Update duplicate records

    thanks LKBrwnDBA for the help...sorry late reply, was sick :-(
  19. yorge

    Delete/Update duplicate records

    yup, I do understand cursor but was hoping for a solution that will not involve cursor - but all possible suggestions are welcome and hoping for some sample as well later...tnx for the reply johnherman
  20. yorge

    Delete/Update duplicate records

    im not sure what happened to the indents on the sample rows but NAME columns values will be: NAME --------------------------------- Cozaar Cozaar Cozaar Cozaar Skelan Detox NatriumhydrogenkarbonatBraunplus NatriumhydrogenkarbonatBraunplus...

Part and Inventory Search

Back
Top