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
Tag: sql-server-2008
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
Bulk load: An unexpected end of file was encountered in the data file
I am using SQL Server Express 2008 When I’m trying load data from txt file in to this table create table Clients ( ClientID int not null IDENTITY (9000,1), LastName varchar (30)not null, FirsName …
How can I find the dependencies of a multiple objects in sql databases?
sp_depends will provide information for all dependent objects on a particular objects But it is working for only single object , giving information about single object. I want the information about multiple object, How can I achieve it using sp_depend or any other way is there? Answer You want sys.sql_expression_dependencies. This how you get the list of all the dependencies.
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
How to check if the Default Value Constraint exists?
I am using SQL server 2008. I need to find if default value constraint does not exist then create it. Here is what I have tried. IF (NOT EXISTS(SELECT * FROM INFORMATION_SCHEMA….
SQL Server find and replace specific word in all rows of specific column
I have a table TblKit that has columns Id and Number. Id is primary key of type int and Number is varchar(50). The data in the table looks like this: I want to replace all the rows of KIT% with CH in the Number field. The desired output would look like: I have tried this update query: But it is
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
Can I calculate there’s how many weekend days between two dates in SQL Server?
I’m calculating income of hiring equipments for a report. In that, hiring cost in weekend days will be plus 10% more if compare with normal days. So how can I calculate there’s how many weekend days …
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