Skip to content

Tag: sql-server

Find all tables that have ROWGUIDCOL

IS there a system table I can join to so I can query to find all tables with a column flagged as ROWGUIDCOL? thanks! Answer You could utilize sys.columns with COLUMNPROPERTY: SqlFiddleDemo Output:

how i can select records with varbinary type?

I have table in my database that has two column namely data and length. I declare data as a VARBINARY(MAX) and suppose the table has a record with length equal to 5 and data = 0x23 0x00 0x12 0x45 0x34. Table definition: The question: Is it possible to search (with a SELECT query) to find records that has 0x00…

WITH(NOLOCK) : where & when to use

I have 15 tables which are normalized to contain records and many user may be inserting/updating data in these tables( No two user can update the same record(s) simultaneously, this is restricted by client implementation). these 15 tables are updated 1 by 1 in a stored procedure. WITH(NOLOCK) is used where se…

SQL select where column begins with Letters

I have a table tbl1 with row of data: I want to query the the Legal_Doc_No of each ID. The value of each ID is either the TIN or the SSS column. How can I query the TIN and SSS column starting with letters (none) so that only values starting with numbers will be assigned to Legal_Doc_No Answer Most databases

Cannot catch SQL Server alter table error

It is a really simple code, but it cannot catch the error. Or how to catch the error? Thanks. Answer Errors that occur as a result of batch recompilation after deferred name resolution cannot be caught at the same level the error occurs. One work-around is to wrap the DDL in dynamic SQL:

SQL Group By Sum and Nulls

I have a query that fetch the sum of quantity of a certain date with a GROUP BY, but the query is giving me NULL results and not aggregating some values. Here is the query: Select VPC.Armazem …