Skip to content
Advertisement

Tag: sql-server-2008

Get Word Count of a Column using SQL

I have a table with a column called Description. The column is populated with text data. I want to create a query that returns the amount of words in each description. My thought was to create a function that takes in a value, and returns the amount of words found in the inputted text. For example, if the description is

Replace identity column from int to bigint

I am using SQL Server 2008, and I have a table that contains about 50 mill rows. That table contains a primary identity column of type int. I want to upgrade that column to be bigint. I need to know how to do that in a quick way that will not make my DB server unavailable, and will not delete

sp_change_users_login ‘auto-fix’, ”

How can I execute the sp_change_users_login so that it will auto-fix all local sql accounts? in other words I can run the command to view all local accounts: I now want those list of users to be used in the sp_change_users_login procedure. Answer You could use a cursor to get the list of names, and then loop through the cursor

Multiple conditions on the same column in the WHERE clause

I have a table something like this – How do I return the names of users where PropertyID = 13 AND PropertyVal=’Business Development Analyst’AND PropertyID = 11 AND PropertyVal = ‘Chicago’. How do I do multiple where clauses for the same column? Edit: I need the result set to look like this – Answer

How to count occurrences of a node in SQL XML?

I am trying to do a count on the number of occurrences of the “Colors” node but have been so far unsuccessful. Below is what I have tried so far. If I have the following logic: I get the following error: Msg 2389, Level 16, State 1, Line 50 XQuery [value()]: ‘value()’ requires a singleton (or empty sequence), found operand

Advertisement