Posts

Showing posts with the label sql-server-2008

Sql Table data formation

Image
Clash Royale CLAN TAG #URR8PPP Sql Table data formation I have a below table ID Level StoreId 2604553 3 A 2604553 7 C 2604553 7 D 2604553 7 E 2678540 3 A 2678540 7 A 2678540 3 B 2678540 7 B 2678540 3 C I need out put like Below ID A B C D E 2604553 3 0 7 7 7 2678540 3 3 3 0 0 2678540 3 7 3 0 0 2678540 7 3 3 0 0 2678540 7 7 3 0 0 Please help me how to achieve this. By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Why SQL query takes too long time to execute when fetching bulk data (without space)?

Image
Clash Royale CLAN TAG #URR8PPP Why SQL query takes too long time to execute when fetching bulk data (without space)? I have a problem, when getting bulk amount of data from a table. I have a database table TblJobs , in this table some columns contain bulk amount of data (approx 60,000 characters in this column). TblJobs My table: TblJobs JobId JobTitle JobDescription ---------------------------------------------------------------- 1 Job1 TextTextTextTextTextTextTextTextTextTextTextText... (approx 40,000 characters without any space in job description) 2 Job2 HelloHelloHelloHelloHelloHelloHelloHelloHelloHell..(approx 60,000 characters without any space in job description) 3 Job3 DemoDemoDemoDemoDemoDemoDemoDemoDemoDemoDemoDemo...(approx 60,000 characters without any space in job description) 4 Job4 TestingTestingTestingTestingTestingTestingTesti....(approx 50,000 characters without any space in job description) Str...

Is there a command line to deploy a SQL Server database project?

Image
Clash Royale CLAN TAG #URR8PPP Is there a command line to deploy a SQL Server database project? We are using the SQL Server Database project template with Visual Studio 2010. As part of our integration testing, I would like to first launch a fresh deploy of the database. But short of manually right clicking the project and picking "Deploy", it doesn't seem to be a simple thing to get a fresh copy of the database deployed. The documentation for this project type seems sparse to non-existent. Perhaps I"m looking in the wrong place. If possible, please include a reference to the how-to. Update: Our integration tests are written as unit tests in Visual Studio. So the goal would be to press the Run Tests button, and have the database deploy, and then the tests against it run. 3 Answers 3 I managed to find a command line tool to do this. It's called VSDBCMD.EXE and it comes with ...

Add another character not existing in table when export to text file

Image
Clash Royale CLAN TAG #URR8PPP Add another character not existing in table when export to text file I create a procedure to export data to text file. It be like: 'bcp "select name,age,grade from test" queryout C:test.txt however i want to add some other character like |. And output file content would be like: Jones|6 C. Which is the most convenient way to do that. Should i create a temporary table? you mean use | as seperator ? use a BCP format file – Squirrel 10 mins ago | BCP @Squirrel that's such a good answer. I never think about that solution. so my command should be 'bcp "select name,age,grade from test" -i test.fmt queryout C:test.txt Is it right? – Nguyen Van Hung 6 mins ago ...

Backup a single table with its data from a database in sql server 2008

Image
Clash Royale CLAN TAG #URR8PPP Backup a single table with its data from a database in sql server 2008 I want to get a backup of a single table with its data from a database in SQL Server using a script. How can I do that? SQL Import/Export Wizard. Right click on your database in SMSS/ Choose Item Export – realnumber3012 Oct 31 '13 at 4:18 I want do this with script – EBS Oct 31 '13 at 4:21 please accept MGOwen's Answer – greg121 Nov 9 '15 at 14:16 9 An...

SQL Join Same Table and create single row result to complete NULL values

Image
Clash Royale CLAN TAG #URR8PPP SQL Join Same Table and create single row result to complete NULL values I have only one source table in SQL. I am trying to join it to itself so that i can fill up NULL values and retain the priority values into single row. There are million of records. FROM THIS: ID1 Source1ID Source2ID Owner Source1Date Source1Desc Source2Date Source2Desc 8 123 567 Source1 1/1/1900 Active NULL NULL 9 123 555 Source2 NULL NULL 12/1/2000 Ongoing TO THIS (expected result): ID1 Source1ID Source2ID Owner Source1Date Source1Desc Source2Date Source2Desc 8 123 555 Source1 1/1/1900 Active 12/1/2000 Ongoing So how can i join the table to itself to attain that single row result? I have tried using the query below and made it as a VIEW but it takes forever to execute just to retrieve 1 row. --CREATE VIEW dbo.vw_JOIN AS WITH MyTABLE AS ( SEL...