I’m looking for a fast way to calculate the hamming weight/population count/”the number of 1 bits” of a BINARY(1024) field. MySQL has a BIT_COUNT function that does something like that. I couldn’t find a similar function in T-SQL? Or would you suggest storing the binary data in a field of another type? If you don’t know what I’m talking about,
Tag: sql-server
SQL Server Compact Edition ISNULL(sth, ‘ ‘) returns a boolean value?
I have an Accounts table with columns name, password and email. They are all type nvarchar. I wrote a query like SELECT name, password, ISNULL(email, ‘eeee’) FROM Accounts WHERE name = ‘” + …
How to find which columns don’t have any data (all values are NULL)?
I have several tables in a database. I would like to find which columns (in which tables) don’t have any values (all NULL in a column). I the example below, the result should be I don’t have any idea how to create this kind of query. Your help is most appreciated! Answer For a single column, count(ColumnName) returns the number
sql exception : The statement has been terminated
I’m running this SQL statement and I’m getting help,please Answer A string you are trying to insert is longer than the max nr of charachters. E.g. like a string with 4001 charachters in a varchar(4000) datatype.
Generate class from database table
How can I generate a class from a SQL Server table object? I’m not talking about using some ORM. I just need to create the entities (simple class). Something like: Given some table like: Answer Set @TableName to the name of your table.
Caching SQL queries
If I look in my profiler for SQL-server, it comes up with a lot of duplicate queries such as: A lot of these queries are not needed to display real time data, that is, if someone inserted a new record that was matched in that query it wouldn’t matter if it didn’t display for up to an hour after insertion.
Join query on Date Range
HI I have following tables and so on for whole year I want the following output I need to take join between these two tables but i couldn’t figure how join condition will be look like Ragards Answer
For VAT tax, what is the correct Decimal(p, s) precision and scale for SQL Server field size declaration?
I am defining VAT rates (European and other countries levy the VAT tax) in a SQL Server database and am wondering what the ideal decimal definition to capture the necessary precision. I have seen VAT rates of: I am curious if there are cases where the VAT rate requires more precision than decimal(4, 3) where p is precision and s
SQL query for today’s date minus two months
I want to select all the records in a table where their date of entry is older then 2 months. Any idea how I can do that? I haven’t tried anything yet but I am on this point: Answer If you are using SQL Server try this: Based on your update it would be:
passing parameters to a stored procedure in C#
How can i send three parameters a to stored procedure in sql? Here is my error: Procedure or function GetIslemIdleri has too many arguments specified. This is my stored procedure: CREATE PROCEDURE …