Posts

Showing posts with the label SQL

Get all foreign keys reference in sql server

Solved: EXEC sp_fkeys 'TableName' its return to all foreign key reference to make that tables

The tablix 'Tablix' is invalid. The value for the DataSetName property is missing.

The tablix is invalid. The value for the DataSetName property is missing. Solved: This is simply define any datasource field to rdlc report column.its cannot be empty without any passing dataset field.

How to make script with data in sql

Image
Solved  Now we describe to step by step for easy to understand that how to make script with schema and data in SQL Server. 1- First you right click on desired database which you want to make script then select Tasks --> Generate Scripts... 2- Show new window for generating script click to Next button. 3- Select all object to specific database after click on Next button. 4- Click to Advance button show script advanced options ( Types of data to script ) option to select Schema and data then click to OK button. click to Next button on previous window. 5- This window for showing summary for generating script. 6- Finally successfully generate the script and you can click to Finish button.

Insert collection of data to sql table using c#

insert collection of data in SQL table is called bulk data manipulations, this is the simple and best way to add multiple row with the single collection now define a step's to easy to understand 1- You make a user defined table types  CREATE TYPE [dbo].[TTMultiRowCollection] AS TABLE(     [ID] [int] NULL,     [Name] [varchar(50)] NULL, ) 2- Create SP and take parameter table type as well as READONLY keyword. CREATE PROCEDURE [dbo].[AddMultiRow](@MultiRowCollection TTMultiRowCollection READONLY) AS BEGIN     INSERT INTO [User](ID,Name)         SELECT ID, Name FROM @MultiRowCollection END 3-  Create table in c# for passing the sql DataTable table = new DataTable(); table.Columns.Add("ID", typeof(int)); table.Columns.Add("Name", typeof(string)); table.Rows.Add(1, "Dawood"); table.Rows.Add(2, "Ahmed"); 4- Connect to SQL server and passing the table from stored procedure  us...

how to get last primary key in sql

Solved: If you want to get last primary key id instead of Max() aggregate function: IDENT_CURRENT('dbo.TableName') this is the best method to get last primary key id this is helpful for logic's

How to use four clause in one query

Get records using with joins, where,group by, having and order by clauses FROM & JOINs determine & filter the selected rows WHERE more filters on the rows to desire columns GROUP BY combines those rows into groups like 1,1,1,2,2,3 result: 1,2,3 HAVING filters groups using to aggregate functions ORDER BY arranges the remaining rows/groups to order wise ascending or descending order