About 4,380,000 results
Open links in new tab
  1. SQL Server PRINT SELECT (Print a select query result)?

    Jan 1, 2010 · If you want to print multiple rows, you can iterate through the result by using a cursor. e.g. print all names from sys.database_principals. I wrote this SP to do just what you want, however, you need to use dynamic sql. This worked for me on SQL Server 2008 R2. @query nvarchar(MAX), @numberToDisplay int = 10, @padding int = 20.

  2. SQL SELECT Statement - W3Schools

    Return data from the Customers table: SELECT column1, column2, ... Here, column1, column2, ... are the field names of the table you want to select data from. The table_name represents the name of the table you want to select data from. Below is a selection from the Customers table used in the examples: 120 Hanover Sq.

  3. How do I return the SQL data types from my query?

    Dec 17, 2014 · The first way to check data types for SQL Server database is a query with the SYS schema table. The below query uses COLUMNS and TYPES tables: SELECT C.NAME AS COLUMN_NAME, TYPE_NAME(C.USER_TYPE_ID) AS DATA_TYPE, C.IS_NULLABLE, C.MAX_LENGTH, C.PRECISION, C.SCALE FROM SYS.COLUMNS C JOIN SYS.TYPES T ON C.USER_TYPE_ID=T.USER_TYPE_ID WHERE C.OBJECT ...

  4. Introduction to SQL Commands, Part 3: Retrieving and Sorting Data

    1 day ago · [Editor's Note: This is Part 3 of a three-part series on commonly used SQL commands.] So far in this article series, I have shown you various SQL Server commands for creating and deleting database tables, as well as commands for creating, modifying, and removing data records within a table.I'll conclude this series by demonstrating how to retrieve data from a SQL Server database table.

  5. PRINT (Transact-SQL) - SQL Server | Microsoft Learn

    Nov 22, 2024 · Returns a user-defined message to the client. For example, in SQL Server Management Studio, PRINT outputs to the Messages tab of the query results window. Transact-SQL syntax conventions. A character string or Unicode …

  6. How to Use SQL SELECT Statement to Fetch Data from Database

    In this tutorial, you'll learn how to fetch data from database tables using the SQL SELECT statement. It covers the syntax of the SELECT statement, how to specify individual columns or retrieve all columns, and how to filter data using the WHERE clause.

  7. SQL putting text in query output - w3resource

    Apr 20, 2024 · The SELECT statement retrieves data from the specified columns: agent_code, agent_name, working_area, and commission. The FROM clause specifies the table from which the data will be retrieved, in this case, the agents table.

  8. Mastering SQL Statements for Efficient Data Retrieval

    Apr 10, 2024 · #Getting Started with SQL SELECT Statements # What is an SQL SELECT Statement (opens new window)? When we talk about an SQL statement (opens new window), we're diving into the world of efficient data retrieval (opens new window).The basic idea behind an SQL SELECT statement is to fetch specific information from a database. It's like asking for just the candies you love from a huge jar instead ...

  9. SQL Server PRINT Statement - Overview with Examples

    Mar 2, 2021 · Printing a string or int value using the PRINT Statement. Using PRINT in the IF…ELSE statement. Using PRINT in the WHILE Loop. The syntax of the PRINT statement is the following: string: The value can be a character or Unicode string. @variable: The character data type must be character or Unicode character data types.

  10. How to Use the SQL Subquery: A Detailed Guide | Codecademy

    Mar 25, 2025 · In this query: The subquery is executed first. It searches the departments table and returns the department_id of the ‘Sales’ department.; Next, the outer query is executed. It retrieves the department_id returned by the subquery and returns all employees whose department_id matches with the retrieved one.; This is how queries, including subqueries, are executed in SQL.

  11. Some results have been removed
Refresh