tagged [sql]

How to execute Table valued function

How to execute Table valued function I have following function which returns Table . ``` create Function FN(@Str varchar(30)) returns @Names table(name varchar(25)) as begin while (charindex(',...

19 Oct at 14:24

How can I declare a Boolean parameter in SQL statement?

How can I declare a Boolean parameter in SQL statement? How can I declare a Boolean parameter in SQL statement?

31 Aug at 01:5

Which sql server data type best represents a double in C#?

Which sql server data type best represents a double in C#? Is it money, float, real, decimal, _________ ?

17 Sep at 18:56

Sql Server : How to use an aggregate function like MAX in a WHERE clause

Sql Server : How to use an aggregate function like MAX in a WHERE clause I want get the maximum value for this record. Please help me: ``` SELECT rest.field1 FROM mastertable AS m INNER JOIN ( ...

Getting only Month and Year from SQL DATE

Getting only Month and Year from SQL DATE I need to access only Month.Year from Date field in SQL Server.

23 Jan at 10:22

Create parameterized VIEW in SQL Server 2008

Create parameterized VIEW in SQL Server 2008 Can we create parameterized VIEW in SQL Server 2008. Or Any other alternative for this ?

1 Mar at 04:55

Create a date from day month and year with T-SQL

Create a date from day month and year with T-SQL I am trying to convert a date with individual parts such as 12, 1, 2007 into a datetime in SQL Server 2005. I have tried the following: but this result...

6 Aug at 13:20

Use a LIKE statement on SQL Server XML Datatype

Use a LIKE statement on SQL Server XML Datatype If you have a varchar field you can easily do `SELECT * FROM TABLE WHERE ColumnA LIKE '%Test%'` to see if that column contains a certain string. How do ...

26 Jul at 14:21

The conversion of the varchar value overflowed an int column

The conversion of the varchar value overflowed an int column For some value of `@nReservationID`: Why do I get this error? > Msg 248, Level 16, State 1, P

8 Mar at 06:42

Convert a string to int using sql query

Convert a string to int using sql query How to convert a string to integer using SQL query on SQL Server 2005?

10 Jan at 11:25

how to get the 30 days before date from Todays Date

how to get the 30 days before date from Todays Date How do you get the 30 days before today in SQL.

23 Feb at 15:24

Determine if table exists in SQL Server CE?

Determine if table exists in SQL Server CE? I know this is similar to [this question](https://stackoverflow.com/questions/167576/sql-server-check-if-table-exists), but I'm using SQL Server CE 3.5 with...

23 May at 12:8

Converting Select results into Insert script - SQL Server

Converting Select results into Insert script - SQL Server I have SQL Server 2008, SQL Server Management Studio. I need to select data from a table in one database and insert into another table in anot...

30 Jan at 12:4

Get Column names from a query without data

Get Column names from a query without data I have a view vwGetData which gets data from two tables t1,t2 and has fields: I will provide below input i want to get below output in C#/SQL or ``` ALIAS1, ...

Generate Dates between date ranges

Generate Dates between date ranges I need to populate a table that will store the date ranges between 2 given dates: 09/01/11 - 10/10/11 So in this case the table would start from 09/01/11 and store e...

T-SQL split string based on delimiter

T-SQL split string based on delimiter I have some data that I would like to split based on a delimiter that may or may not exist. Example data: I am using the following code to split this data into Fi...

Return rows in random order

Return rows in random order Is it possible to write SQL query that returns table rows in random order every time the query run?

23 Jun at 06:31

trim left characters in sql server?

trim left characters in sql server? I want to write a sql statement to trim a string 'Hello' from the string "Hello World'. Please suggest.

11 Jan at 20:50

Finding blocking/locking queries in MS SQL (mssql)

Finding blocking/locking queries in MS SQL (mssql) Using `sys.dm_os_wait_stats` I have identified what I believe is a locking problem Is there a way I can find the top blocking/locking queries? I've t...

Multiple condition in single IF statement

Multiple condition in single IF statement I want to add multiple condition in single IF statement in SQL. I am not good in SQL & referred some example, all are showing only one condition in IF. Here i...

15 Mar at 10:29

SQL Server: Invalid Column Name

SQL Server: Invalid Column Name I am working on modifying the existing SQL Server stored procedure. I added two new columns to the table and modified the stored procedure as well to select these two c...

Column name or number of supplied values does not match table definition

Column name or number of supplied values does not match table definition In the SQL Server, I am trying to insert values from one table to another by using the below query: I am getting the following ...

19 Oct at 22:4

Rounding SQL DateTime to midnight

Rounding SQL DateTime to midnight I am having a small problem with my SQL query. I'm using the GETDATE function, however, let's say I execute the script at 5PM, it will pull up records between 12/12/2...

Convert YYYYMMDD to DATE

Convert YYYYMMDD to DATE I have a bunch of dates in `varchar` like this: How do I convert them to a date format like this: I've tried using this: But get this message: > Msg 241

10 Mar at 00:11

How do you strip a character out of a column in SQL Server?

How do you strip a character out of a column in SQL Server? How do you remove a value out of a string in SQL Server?

11 Jun at 20:17