What is the equivalent of 'describe table' in SQL Server??

I have a SQL Server database and I want to know what columns and types it has. I'd prefer to do this through a query...

Trigger to block insert into SQL Server?

I have a requirement to prevent insert into table using after insert based on certain condition. When I am calling i...

What does the pipe operator do in SQL??

I am redeveloping an application and have found this sql statement, what does the | character do in this part (au.Ex...

Cast and Sum functions?

I am writing a macro which pulls data from Oracle and displays in Excel. In Oracle DB we have a custom table with a ...

How to query MongoDB with “like”??

I want to query something with SQL's like query: SELECT * FROM users WHERE name LIKE '%m%' How to do I achieve t...

store result of select query into array variable?

I want to store the result of this sql query in variable a the result will be formed of 17 row how to edit this code...

Why would a database timeout??

when i run queries to the database im constantly getting this System.Data.SqlClient.SqlException: Timeout expired. ...

SQL Server AS statement aliased column within WHERE statement?

I want to execute a query in which I rename one of the columns using the 'AS' statement and reuse that aliased colum...

MySQL error: key specification without a key length?

I have a table with a primary key that is a varchar(255). Some cases have arisen where 255 characters isn't enough. ...

MySQL error: key specification without a key length?

I have a table with a primary key that is a varchar(255). Some cases have arisen where 255 characters isn't enough. ...

Oracle NVL equivalent in SAS?

I need to convert the sql code to sas code; NVL(SPRTELE_STATUS_IND, 'A') = 'A' AND NVL(SPRTELE_PRIMARY_IND, 'Y...

DateTime group by date and hour?

I have a datetime called activity_dt and the data looks like this: 2/5/2013 9:24:00 AM 2/7/2013 7:17:00 AM How do...

DB2: Won't Allow “NULL” column??

Part of a complex query that our app is running contains the lines: ...(inner query) SELECT ... NULL as column_A, N...

How to increase dbms_output buffer??

I tried to debug my dynamic query via dbms_output but seems like the query string is too long for dbms_output buffer...

Cast to int on SqlCommand-ExecuteScalar error handling?

I have code that is possibly fragile. This statement here int countDis = (int)cmd.ExecuteScalar(); If I change t...