Transact SQL – Schema – Operations

Background

Wanted to document a couple of operations one can take on schemas.

Outline

  1. Check Existence
  2. Create Schema
  3. Change Object’s Schema ( Transfer Object from one schema to another)
  4. Grant Permission

Action

Exist?

Syntax

schema_id()

Sample

set nocount on
go

set XACT_ABORT on
go

declare @schema sysname
declare @schemaID int

set @schema = 'security';

set @schemaID = schema_id(@schema);

if ( @schemaID is null )
begin

	print 'Schema ' + @schema + ' does not exist!'

end
else
begin

	print 'Schema ' + @schema + ' exists'

end

Create

Syntax

create schema [schema] authorization [owner];

Sample

if schema_id('security') is null
begin

	exec('create schema [security] authorization [dbo]');

end

Change Object Schema

Syntax


alter schema [schema-new]
   transfer [scheme-current].[object-current]

Sample


set nocount on;
go

set XACT_ABORT on;
go

declare @object sysname
declare @commit bit

set @object = 'permission';

set @commit = 0

if schema_id('security') is null
begin

    exec('create schema [security] authorization [dbo]');

end

begin tran

    --exec sp_help '[dbo].[permission]'

    select
              [schema] = tblSS.[name]
            , [object] = tblSO.[name]

    from   sys.objects tblSO

    inner join sys.schemas tblSS

            on tblSO.schema_id = tblSS.schema_id

    where  tblSO.[type] = 'U'

    and    tblSO.[name] = @object

    if object_id('[dbo].[permission]') is not null
    begin

        alter schema [security]
            transfer [dbo].[permission]

    end	

    -- exec sp_help '[security].[permission]'

    select
              [schema] = tblSS.[name]
            , [object] = tblSO.[name]

    from   sys.objects tblSO

    inner join sys.schemas tblSS

            on tblSO.schema_id = tblSS.schema_id

    where  tblSO.[type] = 'U'

    and    tblSO.[name] = @object

while (@@trancount > 0)
begin

    if (@commit = 1)
    begin

        print 'commit  tran'
        commit tran;

    end
    else
    begin

        print 'rollback tran'
        rollback tran;

    end

end

Grant Permissions

Syntax


    grant [permission] on [schema]::[schema-name] to [database-principal];

Sample


set nocount on
go

set XACT_ABORT on
go

declare @schema sysname
declare @schemaID int
declare @commit   bit

set @commit = 0

set @schema = 'security';

set @schemaID = schema_id(@schema);

begin tran

	if ( @schemaID is null )
	begin

		print 'Schema ' + @schema + ' does not exist!'

	end
	else
	begin

		print 'Schema ' + @schema + ' grant permission'

		grant select on schema::[security] to [public];

	end

while (@@trancount > 0)
begin

    if (@commit = 1)
    begin

        print 'commit  tran'
        commit tran;

    end
    else
    begin

        print 'rollback tran'
        rollback tran;

    end

end

Rev. Dr. Claudette Anderson Copeland

 

Videos

  1. A Conversation with Rev. Dr. Claudette Anderson Copeland hosted by Dr. Frank A. Thomas
    • Videos
      • A Conversation with Rev. Dr. Claudette Anderson Copeland hosted by Dr. Frank A. Thomas
        Published On :- 2017-Sept-4th
        Link
  2. Hide me message
    • Videos
  3. God is a finisher
    • Videos

 

 

In-depth

A Conversation with Rev. Dr. Claudette Anderson Copeland hosted by Dr. Frank A. Thomas

  1. By Age of 12
    • Already sexually damaged
  2. Sought Jesus
    • Began looking for Jesus even though I did not know it was Jesus I was looking for
    • Looking for something more
  3. Classmate
    • Started harassing me about my salvation
    • Tormented me until I started to attend to the Sanctified Church
  4. 13/14 years old
    • Will of Jesus realized in my life
  5. Sin
    • All sin I learnt in my life, I learned in Church
  6. Claudette to Frank
    • Thank you for blowing the clean wind; I love you very much
  7. 15 years
    • Call to Ministry is simultaneous with Salvation
    • A life long Yes
    • Season in Life been called forward
    • There is something in your life, but God does not use women
    • we have to recognize that
    • Women called into Missionary Track
    • Trial Sermon
  8. Women
    • Floor of Church as I could not go into the Pulpit
  9. Mentor
    • Not afraid of women
    • Dangerous eye of women
    • Learned to duck
    • Learned to edit myself
    • Dr. Ellen Goodwin
      • 4 feet tall
      • First took me to Haiti
      • hey may not like you but they cannot kill you
    • Ernestine Cleveland Timm???
      • Church of God in Christ
      • Oakland, CA
      • Was 12 years old at the time
      • Her baby was 2
      • Drunk men will stand and lay there bottle down
      • What do I have to do to know Jesus
      • Authentic connection to the unseen
    • But, God don’t use women
      • Remember that gentle, humble women
      • she always stayed on my shoulder
    • After Seminary
      • Every door shut
      • Meet Claudette
      • My ministry was worthy
      • Not afraid of the men
      • Validity of what God was doing in my life

 

Hide me message

  1. Bible Verses
    • Collosians
      • Collosians 3:1-3
        • Since, then, you have been raised with Christ, set your hearts on things above, where Christ is, seated at the right hand of God. 2 Set your minds on things above, not on earthly things. 3 For you died, and your life is now hidden with Christ in God.
      • Matthew 13:44
        • “The kingdom of heaven is like treasure hidden in a field. When a man found it, he hid it again, and then in his joy went and sold all he had and bought that field.
  2. Hide me
    • For you are dead
  3. Crisis
    1. Intersection between danger and opporunity
  4. Book
    • Crisis in Village
      • Family
        • Crisis of Commitment
        • Loving Bond between Man & Women
        • Lack of commitment
      • School
        • Colleges of Moral Purpose
        • Hard erosion of the gains our people made
      • Crisis of Mission
        • Not about the blood
        • Not much about the altar
        • Socially Relevant
    • Broken Conscience
    • Seek those things at above
    • Set affection in what is above
  5. Public VS Private
    • Public
      • Theologian
        • City set above a hill
      • Ministry of Christian
        • Yes, ministry life and public expression of faith is supposed to be in public
        • Gifts used in public
    • Private
      • Private reality of your life
      • Do not banter away
  6. Natural Growth
    • Stopped sunlight from coming in
    • Change chemistry of soil
    • Began killing Oak Tree
  7. What grew naturally
    • Ego
    • Sexual Curiosity
    • Ambition
  8. The anointing ON you is for the deliverance of others BUT the anointing IN you is for you

God is a finisher

  1. Hosea 7:8
    • Ephraim, he hath mixed himself among the people; Ephraim is a cake not turned.

 

Bishop Jackie McCullough – “By My Spirit”

 

  1. Bishop Jackie McCullough :- “By My Spirit”
    • Bishop Jackie McCullough Preaches PFI Holy Convocation 2018
      Bishop Jacqueline E. McCullough preaches and ministers powerfully during the third evening worship service of the 2018 Holy Convocation for Perfecting Fellowship International on 5/23/2018 presided by Bishop-Elect Marvin L. Winans Sr. in Detroit, MI
      Channel :- Church Boy
      Date Published :- 2018-May-23rd
      Link
  2. A Message to the Heart
    • A Message to the Heart
      During the 1990’s Carlton Pearson held annual revivals that he called Azusa Conferences in Tulsa, Oklahoma. People from all over the United States and speakers from all over the world came to participate in these Azusa Conferences. Even though Carlton Pearson’s current teachings (mainly the “Gospel Of Inclusion”) contradicts the word of God; it can’t be denied that his previous works/teachings were anointed. In 1994 Jackie McCullough delivered this powerful message on getting your heart right before God.
      Channel :-
      Harmilee Cousin III
      Date Published :- 2011-Oct-2nd

      Link

 

In depth

Bishop Jackie McCullough – “By My Spirit”

  1. Favorite Verse
    • I am Thine, O Lord, I have heard Thy voice
      • Consecrate me now Lord
  2. Zachariah 4:6-9
    • 6 So he said to me, “This is the word of the Lord to Zerubbabel: ‘Not by might nor by power, but by my Spirit,’ says the Lord Almighty.
    • 7 “What are you, mighty mountain? Before Zerubbabel you will become level ground. Then he will bring out the capstone to shouts of ‘God bless it! God bless it!’”
    • 8 Then the word of the Lord came to me:
    • 9 “The hands of Zerubbabel have laid the foundation of this temple; his hands will also complete it. Then you will know that the Lord Almighty has sent me to you.
  3. Zachariah – The Book

    • Chapter 1-8
      • Present
        • Encourage to finish building temple
        • Physical edifice
    • Chapter 9-14
      • Future
        • Something greater coming than this physical temple
        • Messiah coming also
        • Build the soul, as well
  4. Contemporary of Haggai
  5. Political and strategic
    • Access to the King
    • Not about your connection to the King
  6. Vision made clear
    • In a slumber
    • I don’t want the vision to go away
    • Get the vision back in place
    • come again and jar me
    • What seetheth thou
  7. Zachariah 4:4
    • I asked the angel who talked with me, “What are these, my lord?”
  8. Olive tree
    • Olive tree continuously supply the oil
    • Not in the hands of man
    • Oil of God
  9. Pentecost
    • Holy Spirit continuous
  10. Haggai 2:5
    • This is what I covenanted with you when you came out of Egypt. And my Spirit remains among you. Do not fear.’
    • Spirit remain among you
  11. Hosea 1:7
    • Gomer conceived again and gave birth to a daughter. Then the Lord said to Hosea, “Call her Lo-Ruhamah (which means “not loved”), for I will no longer show love to Israel, that I should at all forgive them.
    • Yet I will show love to Judah; and I will save them—not by bow, sword or battle, or by horses and horsemen, but I, the Lord their God, will save them.”
  12. Holy Spirit
    • Enables me
    • Convicted me
    • Lead me
  13. John 16:7
    • But very truly I tell you, it is for your good that I am going away. Unless I go away, the Advocate will not come to you; but if I go, I will send him to you.
  14. Paul
    • 2nd Corinthians 12:8-10
      • My strength is made perfect in weakness
      • that the power of Christ may rest upon me
      • Therefore I take pleasure in infirmities, in reproaches, in needs, in persecutions, in distresses, for Christ’s sake.
      • For when I am weak, then I am strong.
  15. Sometimes you don’t know what to pray for
    • When you groan and moan
  16. Zerubbabel
    • Tribe of Judah
    • He had position
    • Strive for Status and Position
    • Ordered by Cyrus
    • Task of building the temple
    • Altar
      • He built an altar
    • Foundation
      • Lay the foundation for Spiritual formation
      • Lay the foundation for worship
      • In Babylon they did not have congregational worship
    • Sacrifice
  17. Gideon
    • God always renames us
    • Oh Though Man of Valor ( Judges 6:11-13 )
      • Then the Angel of the LORD came and sat down under the oak in Ophrah that belonged to Joash the Abiezrite, where his son Gideon was threshing wheat in a wine-press to hide it from the Midianites.
      • And the Angel of the LORD appeared to Gideon and said, “The LORD is with you, mighty warrior.”
      • “Pardon me, Sir,” Gideon replied, “but if the LORD is with us, why has all this happened to us?
    • Dysfunctional
      • I come from a dysfunctional family
        • 14 The Lord turned to him and said, “Go in the strength you have and save Israel out of Midian’s hand. Am I not sending you?
        • 15 “Pardon me, my lord,” Gideon replied, “but how can I save Israel? My clan is the weakest in Manasseh, and I am the least in my family.”
        • 16 The Lord answered, “I will be with you, and you will strike down all the Midianites, leaving none alive.”
      • Too many of them
        • When we don’t have enough of them
        • Send the fearful home
        • Fear is an indication that you are protecting yourself
      • Rotten
        • Born an enemy to God
        • In his mercy, God stepped out of Heaven and came and rescued us
  18. Built Together
    • The Bible says we are built together
      • And in him you too are being built together to become a dwelling in which God lives by his Spirit.
        ( Ephesians 2:22 )
      • Ye also, as lively stones, are built up a spiritual house, an holy priesthood, to offer up spiritual sacrifices, acceptable to God by Jesus Christ.
        ( 1st Peter 2:5 )

Steve Kerr – Leadership Lessons

By Mackey Craven
OpenView
Published On :- 2017-July-17th

Link

True leadership springs from a deep understanding of simple but profound tenets that can be successfully applied to any team scenario, whether the team in question is setting league records or building a company. Earlier this year, at OpenView’s CEO Forum, I had the chance to speak with one of the great leaders in sports today – Steve Kerr, head coach of the Golden State Warriors.

Kerr’s NBA career highlights reel features an impressive series of accomplishments. As a player, he was a five-time NBA champion with the Chicago Bulls (three rings) and the San Antonio Spurs (two rings). To date, his record for the highest career three-point percentage (45.4%) remains unbroken. Kerr’s winning streak continued when he transitioned into coaching. In his first season as head coach he led the Warriors to win the 2015 NBA Championship, in 2016 he was named NBA Coach of the Year as the Warriors set an NBA record 73-win season, and as of this article’s publication, the Warriors won another NBA Championship (congratulations!).

 

I talked with Kerr about his leadership style and philosophy given the parallels between his role and that of a startup CEO. Both coach and CEO work hard to get the most out of their teams – encouraging high-performing individuals to work together to win against an incredibly challenging field of competitors. Both are working in a fast-paced environment with high stakes, big personalities and many do-or-die moments.

My conversation with Kerr surfaced a number of insights that can help CEOs of expansion-stage software companies motivate and manage their teams more effectively so they can achieve the kind of dominance the Golden State Warriors see on the court.

Find your mentors, but be true to yourself

Kerr’s first observation about the most important leadership lessons he’s learned from his experience with the Warriors combined two, seemingly opposite ideas: seeking out mentors and being yourself. After he explained, however, the combination made complete sense.

“One of the things I did for a couple of years before I got the head coach job with the Warriors was to visit as many coaches as I could – especially the ones I admired – and really pick their brains, ” Kerr recalls. He met with legendary coaches including Phil Jackson, Gregg Popovich, Lute Olson, Lenny Wilkens and Pete Carroll. “I was able to get an in-depth look at their teams and staffs, and they shared with me the mistakes they’d made as young coaches as well as how they got better as they went along.”

But, even as Kerr was taking in all this wisdom from all these star coaches, he realized that no one person had all the right answers. “The main theme that came across over and over again in these conversations was be yourself,” he says. “There’s no point in trying to be someone else. You can emulate somebody else, but you can’t be someone else. As soon as you start quoting Vince Lombardi, players are going to know it’s fake.”

The bottom line is that while it’s wise to seek out and learn from mentors early on, you need to develop your own, authentic and genuine leadership philosophy and style.

Define your values

One of the most important pieces of advice that Kerr received while he was visiting with different mentors was to take the time to clearly define his philosophy, values and vision for the team. “One of the biggest things for me, as a coach, was the opportunity to implement the things that are most important to me and reflect my values,” Kerr explains. “Sharing those with your team and making those values part of your everyday existence in a way that comes from your heart is where you’ll find traction.”

Kerr got some great tactical tips on how to identify his values when he went to Seattle to sit in on a training camp with Pete Carroll, coach for the Seahawks. “Pete told me to take a look at my own personality and write down the ten most important values in my life,” Kerr says. “Then, he told me to take those ten values and whittle them down to four by really thinking about what would be most important to me as a coach.” Kerr came away from that exercise with four clearly defined values that he has used ever since to guide the Warriors on a daily basis:

Joy

“We are the luckiest people on earth,” Kerr says. “We play basketball for a living. People dream of that, so we never, ever want to lose sight of the fact that this has got to be fun. We make sure that’s reflected each day – we joke around, make fun of each other and include stupid videos in our strategy sessions. Our guys laugh quite a bit.”

Competitiveness

“Winning has to matter, and to win at this level, you’d better be competitive,” Kerr says. “It’s important to keep score constantly, to always keep track of who is winning and who is losing, even in practices. But,” he adds, with a nod to the value of joy, “do it in a fun way.”

Mindfulness

“One of the trickiest things for a pro athlete is finding the balance between over thinking and not paying attention. There’s a sweet spot where you’re dialed in, but still loose,” Kerr says. “We’re always trying to find that balance and have found that mindfulness training can help.”

Compassion

“Playing in the NBA is a dream job, but it’s a difficult one, relatively speaking. Our guys aren’t digging ditches, but they do get booed and traded and cut and injured. It’s not easy,” Kerr says. “Players worry about their careers. They lose sleep when they’re not playing well. So, compassion is a big deal.”

Get to know your team

Another big element of Kerr’s leadership style is strong relationships – real, person-to-person relationships based on compassion, trust and respect. “As soon as I’d accepted the job with the Warriors, I called each of our fifteen players and in many cases traveled to see them,” Kerr says, recalling how he even flew to Australia to visit Andrew Bogut. “I wanted to make sure that I got to know each player on a personal level – find out about their families, who they are and what makes them tick.”

Kerr had learned this technique from coaches he’d played for and admired, including Popovich and Jackson. “I knew those guys cared about me because they went out of their way to find out about my kids and my wife and what I like to do in my free time,” Kerr recalls. “And once you know that they really care about you, then when they yell at you, it’s very acceptable.”

This initial “tour” to meet his players was a great chance for Kerr to spend quality time with his team, but it was also an opportunity for him to lay the initial groundwork for his vision. “I wanted to have my message really well put together for them, both individually and team-wise,” he says. “I wanted to be able to establish what we were looking to do as a team, our goals and where I saw each player fitting in before we even got on the practice floor.”

“It’s really important,” Kerr sums up, “for people underneath you to recognize that you care about them and that they are valued.”

Study your team’s strengths and weaknesses

Of course, an important part of getting to know your team is being able to assess their strengths and weaknesses. “In basketball, you try to be the best you can be based on your talent,” Kerr explains. “In the off-season you assess your weaknesses – which player can we get to fill that hole or to really strengthen a particular position. And then you play, and figure out how good you are.”

At the same time, you need to constantly assess the competition. “Each time you play a team, you are trying to find their weak spot and how do exploit it,” Kerr says. “And, on the flip side, you are also trying to protect your own weaknesses, knowing that other teams will be coming after you in those areas. It’s a constant process of evaluating where you are against the other teams.”

While evaluating your team is an important leadership role, it’s important to approach it with humility and respect. This becomes even more important when you’re heading up a group of high-performing individuals who are already extremely talented in their own right. “I was lucky to inherit a team that was skilled and talented, and it was important to acknowledge that,” Kerr says about when he initially joined the Warriors. “When I took the job, they had already won fifty games the previous year. We needed to come in as staff saying that we knew they were already good, but that we wanted to help them take the next step. The team appreciated that we came in with some humility.” And from there, the focus was on how they could all get better together.

This approach had a far-reaching effect not only on the existing team, but also in terms of recruiting. “One of the reasons we got Kevin Durant was that he had seen our culture from afar,” Kerr says. “He saw our desire to get better and work together. And he saw the fun we were having.”

Empower your team to take ownership

In 2016, Kerr missed the first half of the season – approximately forty games – due to a serious back injury. Despite not having their head coach on the sidelines, the Warriors had the best regular season record of all time in the NBA. While Kerr wasn’t happy about having to miss those games, his feelings are mitigated by the pride he felt in his team’s ability and performance.

“It’s almost like being a parent,” Kerr says. “You’re kids are getting older and you’re no longer telling them what to do all the time, but they’re still doing well. That’s when you know you’ve done a good job as a parent; and that’s kind of how I feel about coaching in general. I actually took a lot of pride in the fact that the team was doing so well while I was out because I recognized that the process had really performed from the previous year, and we were able to carry that over. That’s ultimately what you want.”

Getting to that point of team strength and capability takes a lot of work. “At the beginning of the season, it’s the coach’s job to lay out the vision for the team, but by the end of the season it’s the players’ team,” Kerr explains. “I might call a timeout once in awhile, or draw up a play; but most games, I just sit back and the players play. It’s their team. It’s our job to empower them and get them on the right track so they are equipped to take ownership.”

That’s kind of the end game for any leader – getting the team to take ownership of the plays. It’s the leader’s job to deliver the right vision, create the right environment, and provide the right guidance so that each team member can reach his or her highest potential. Sometimes, that takes some cheerleading, and sometimes it takes some constructive criticism. “Some people need a pat on the back, and others need a kick in the tail,” Kerr says. “I ask my staff all the time what each player needs – a confidence boost or a sharp stick.”

For the Warriors, Kerr has the team meet to watch and critique film each day for ten minutes before practice. “We go over what we are trying to accomplish as a group in a very practical way,” he adds. “The cheerleading comes in behind the scenes. If I were to constantly tell the team how great they are, it would be almost patronizing. But, it’s good for me to tell an individual player when they are doing great work. You need to be able to recognize what each person needs to hear and when they need to hear it. Each person is unique and each day is a little different.”

15 Years Ago Today

Soul On Rice

I was a bit worried, scared I guess. I wasn’t sure what to expect. My release date finally reached reality. I had ideas and plans but I knew, especially then, that circumstances don’t always fall in line with plans. Desires and life aren’t engaged in a symbiotic relationship. As I stepped through those gates, my feet touching free ground, it was like entering a new world, like I had never before experienced freedom. I was unfamiliar with it. I’d forgotten what it was like to be free, what it was supposed to feel like.

I wore the clothes my mother and sister sent me in a “release package,” an orange t-shirt, dark blue jeans, very baggy, and the pair of Timberland boots I requested. There’s a picture of this moment, somewhere, I don’t have it with me now, but I remember it because I once framed it. I even taped…

View original post 274 more words

SQL Server – SSMS – Creating New Credentials – Error – “Cannot determine whether computer is joined to a domain”

Preface

Following a guideline on running “SQL Server Agent Job Steps” via Proxy Agent and tumbling badly out of the gate.

 

Error

Textual

The error is “The program cannot open the required dialog box because it cannot determine whether the computer named <computername> is joined to a domain. Close this message, and try again“.

Image

cannotdeterminewhethercomputerisjoinedtoadomain-brushedup

 

Recreation

  1. Launch SQL Server Management Studio ( SSMS )
  2. Connect to the SQL Server Instance
    • Choose the SQL Instance
    • Navigate the tree to Security \ Credentials
    • Right click on Credential and from the drop down menu choose “New Credential
    • “New Credential” Window
      • The “New Credential” windows is displayed
      • Click on the Identity button
      • The system stays busy for a bit and the error pasted above comes up

 

Screen Shot

New Credentials – Trigger

newcredentialtrigger-brushedup

 

New Credentials – Identity Button Clicked

newcredentialtrigger-brushedup

 

Diagnostic

Network Diagnostic

netstat

Syntax


netstat -an | find "SYN"

Output

netstat-synstat-20161215-1006am-brushed-up

 

Explanation

  1. We see that we stuck trying to connect to port 445 on our destination SQL Instance
    • Stuck?
      • SYN_SENT Status means stuck
    • Port 445
      • SMB Traffic

 

Remediation

Have your Network\Firewall team open up Port 445 ( SMB traffic )

 

Workaround

Do the unthinkable, open up a Query window and enter the corresponding Transact SQL Statements.

Please lookup “Create Credential“.

 

References

  • Create a Credential
    Link