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...
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
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...
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
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...
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...
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.
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.
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...
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...
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
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...
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
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...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.